-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lisätään sijoitusehdotuksen hylkäyksen syy hakemuksen muistiinpanoihin #6000
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ import fi.espoo.evaka.application.ApplicationStatus.WAITING_DECISION | |
import fi.espoo.evaka.application.ApplicationStatus.WAITING_MAILING | ||
import fi.espoo.evaka.application.ApplicationStatus.WAITING_PLACEMENT | ||
import fi.espoo.evaka.application.ApplicationStatus.WAITING_UNIT_CONFIRMATION | ||
import fi.espoo.evaka.application.notes.createApplicationNote | ||
import fi.espoo.evaka.application.persistence.club.ClubFormV0 | ||
import fi.espoo.evaka.application.persistence.daycare.DaycareFormV0 | ||
import fi.espoo.evaka.attachment.AttachmentType | ||
|
@@ -694,6 +695,7 @@ class ApplicationStateService( | |
user: AuthenticatedUser, | ||
clock: EvakaClock, | ||
unitId: DaycareId, | ||
rejectReasons: Map<PlacementPlanRejectReason, String>, | ||
) { | ||
accessControl.requirePermissionFor( | ||
tx, | ||
|
@@ -703,17 +705,35 @@ class ApplicationStateService( | |
unitId, | ||
) | ||
|
||
tx.execute { | ||
sql( | ||
""" | ||
data class PlacementPlanReject( | ||
val applicationId: ApplicationId, | ||
val unitRejectReason: PlacementPlanRejectReason, | ||
val unitRejectOtherReason: String?, | ||
) | ||
tx.createUpdate { | ||
sql( | ||
""" | ||
UPDATE placement_plan | ||
SET unit_confirmation_status = 'REJECTED' | ||
WHERE | ||
unit_id = ${bind(unitId)} AND | ||
unit_confirmation_status = 'REJECTED_NOT_CONFIRMED' | ||
RETURNING application_id, unit_reject_reason, unit_reject_other_reason | ||
""" | ||
) | ||
} | ||
) | ||
} | ||
.executeAndReturnGeneratedKeys() | ||
.toList<PlacementPlanReject>() | ||
.forEach { | ||
val reason = | ||
when (it.unitRejectReason) { | ||
PlacementPlanRejectReason.OTHER -> it.unitRejectOtherReason | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pitäiskö tässä prefixata muistiinpanon sisältöä hieman, jotta se on yksiselitteisempi: Niin, että muistiinpanon sisällöksi tulee esim. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||
else -> rejectReasons[it.unitRejectReason] | ||
} | ||
if (reason != null) { | ||
tx.createApplicationNote(it.applicationId, reason, user.evakaUserId) | ||
} | ||
} | ||
|
||
val validIds = | ||
tx.createQuery { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tämän voisi nimetä uudelleen:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍