Update supervisorId handling in ChurchApplication and FalukantService: Allow supervisorId to be null for entry-level positions, enhancing flexibility in application processing. Improve prerequisite office type updates in initializeFalukantTypes for better data integrity.
This commit is contained in:
@@ -1139,7 +1139,17 @@ export const initializeChurchOfficePrerequisites = async () => {
|
||||
prerequisiteOfficeTypeId: prerequisiteOfficeTypeId
|
||||
}
|
||||
});
|
||||
if (wasCreated) created++; else existing++;
|
||||
if (wasCreated) {
|
||||
created++;
|
||||
} else {
|
||||
// Aktualisiere, falls sich die Voraussetzung geändert hat
|
||||
if (record.prerequisiteOfficeTypeId !== prerequisiteOfficeTypeId) {
|
||||
await record.update({ prerequisiteOfficeTypeId: prerequisiteOfficeTypeId });
|
||||
created++; // Zähle als Update
|
||||
} else {
|
||||
existing++;
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (falukantDebug) console.error('[Falukant] ChurchOfficePrereq Fehler', { officeId: office?.id, error: e.message });
|
||||
throw e;
|
||||
|
||||
Reference in New Issue
Block a user