Skip to content
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

Merkitään hakemus salassapidettäväksi jos siinä on liite #6344

Merged
merged 1 commit into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1041,13 +1041,15 @@ fun Database.Transaction.updateForm(

fun Database.Transaction.resetCheckedByAdminAndConfidentiality(
id: ApplicationId,
form: ApplicationForm,
now: HelsinkiDateTime,
modifiedBy: EvakaUserId,
) {
val application = fetchApplicationDetails(id) ?: return
val form = application.form
val confidential =
when {
form.child.assistanceNeeded ||
application.attachments.isNotEmpty() ||
form.child.assistanceNeeded ||
form.child.allergies.isNotBlank() ||
form.child.diet.isNotBlank() ->
true // If any of these fields are filled, the application is always confidential
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,6 @@ class ApplicationStateService(
val applicationFlags = tx.applicationFlags(application, currentDate)
tx.updateApplicationFlags(application.id, applicationFlags, clock.now(), user.evakaUserId)

tx.resetCheckedByAdminAndConfidentiality(
applicationId,
application.form,
clock.now(),
user.evakaUserId,
)

val sentDate = application.sentDate ?: currentDate
val dueDate =
application.dueDate
Expand Down Expand Up @@ -382,6 +375,8 @@ class ApplicationStateService(
tx.setApplicationProcessId(applicationId, processId, clock.now(), user.evakaUserId)
}

tx.resetCheckedByAdminAndConfidentiality(applicationId, clock.now(), user.evakaUserId)

Audit.ApplicationSend.log(targetId = AuditId(applicationId))
}

Expand Down Expand Up @@ -426,14 +421,9 @@ class ApplicationStateService(
)
}

tx.resetCheckedByAdminAndConfidentiality(
application.id,
application.form,
clock.now(),
user.evakaUserId,
)

tx.updateApplicationStatus(application.id, SENT, user.evakaUserId, clock.now())

tx.resetCheckedByAdminAndConfidentiality(application.id, clock.now(), user.evakaUserId)
}

fun moveToWaitingPlacement(
Expand Down Expand Up @@ -464,13 +454,6 @@ class ApplicationStateService(
)
)

tx.resetCheckedByAdminAndConfidentiality(
applicationId,
application.form,
clock.now(),
user.evakaUserId,
)

asyncJobRunner.plan(
tx,
listOf(AsyncJob.InitializeFamilyFromApplication(application.id, user)),
Expand All @@ -490,6 +473,8 @@ class ApplicationStateService(
}
}

tx.resetCheckedByAdminAndConfidentiality(applicationId, clock.now(), user.evakaUserId)

Audit.ApplicationVerify.log(targetId = AuditId(applicationId))
}

Expand All @@ -510,13 +495,6 @@ class ApplicationStateService(
val application = getApplication(tx, applicationId)
verifyStatus(application, setOf(WAITING_PLACEMENT, CANCELLED))

tx.resetCheckedByAdminAndConfidentiality(
applicationId,
application.form,
clock.now(),
user.evakaUserId,
)

if (application.status == CANCELLED) {
tx.getArchiveProcessByApplicationId(applicationId)?.also { process ->
if (process.history.any { it.state == ArchivedProcessState.COMPLETED }) {
Expand All @@ -527,6 +505,9 @@ class ApplicationStateService(

tx.syncApplicationOtherGuardians(applicationId, clock.today())
tx.updateApplicationStatus(application.id, SENT, user.evakaUserId, clock.now())

tx.resetCheckedByAdminAndConfidentiality(applicationId, clock.now(), user.evakaUserId)

Audit.ApplicationReturnToSent.log(targetId = AuditId(applicationId))
}

Expand Down Expand Up @@ -1202,6 +1183,8 @@ class ApplicationStateService(
updatedForm,
manuallySetDueDate = update.dueDate,
)

tx.resetCheckedByAdminAndConfidentiality(original.id, now, user.evakaUserId)
}

private fun Database.Read.sentWithinPreschoolApplicationPeriod(sentDate: LocalDate): Boolean {
Expand Down Expand Up @@ -1233,7 +1216,6 @@ class ApplicationStateService(
modifiedBy,
)

resetCheckedByAdminAndConfidentiality(original.id, updatedForm, now, modifiedBy)
when (manuallySetDueDate) {
null ->
// We don't want to calculate the due date for applications in the CREATED state.
Expand All @@ -1249,6 +1231,8 @@ class ApplicationStateService(
}
else -> updateManuallySetDueDate(original.id, manuallySetDueDate)
}

resetCheckedByAdminAndConfidentiality(original.id, now, modifiedBy)
}

private fun Database.Transaction.updateManuallySetDueDate(
Expand Down