Refuse a save that changes nothing instead of reporting success
update_position returned quietly when no field differed, and the interface answered "Planstelle geändert." — a confirmation for something that had not happened. It now raises, and the message says so. This is reachable without the user doing anything wrong: the chief checkbox is dropped on the way out when the unit already has a chief position, so a save consisting only of that tick arrives as an empty change set. The reply was a green toast and an unchanged list, which sends someone looking in the wrong place. It also separates the two explanations for "I saved and nothing happened", which is why it went in now: an empty change set is refused in red, so a green confirmation with a stale card can only mean the page did not reload. Verified against the live database: an unchanged payload is refused, a changed one goes through. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -94,8 +94,15 @@ begin
|
||||
v_changes := app_aenderung(v_changes, 'Gültig ab', v_alt.valid_from::text, v_valid_from::text);
|
||||
v_changes := app_aenderung(v_changes, 'Gültig bis', v_alt.valid_to::text, v_valid_to::text);
|
||||
|
||||
-- Nichts geändert ist ein Ergebnis, kein Erfolg.
|
||||
--
|
||||
-- Vorher kehrte die Funktion hier stumm zurück, und die Oberfläche meldete
|
||||
-- „Planstelle geändert." Wer etwas eingetragen hatte, das unterwegs
|
||||
-- verworfen wurde — etwa das Leitungshäkchen, das bei bereits vergebener
|
||||
-- Leitung nicht durchkommt —, sah eine Erfolgsmeldung und eine unveränderte
|
||||
-- Liste. Das ist genau die Rückmeldung, die einen suchen lässt.
|
||||
if jsonb_array_length(v_changes) = 0 then
|
||||
return;
|
||||
raise exception 'Es wurde nichts geändert.';
|
||||
end if;
|
||||
|
||||
update om_positions
|
||||
|
||||
Reference in New Issue
Block a user