Skip to content

Commit

Permalink
remove fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud AMBROSELLI committed Feb 19, 2024
1 parent 88d6c44 commit 3c433f0
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions dashboard/src/components/ActionModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,15 @@ function ActionContent({ onClose, action, personId = null, personIds = null, isM
const body = { ...data };
body.teams = Array.isArray(data.teams) ? data.teams : [data.team];
if (!data.teams?.length) return toast.error('Une action doit être associée à au moins une équipe.');
if ([DONE, CANCEL].includes(data.status)) {
// When status changed to finished (done, cancel) completedAt we set it to now if not set.
body.completedAt = data.completedAt || now();
} else {
// When status just changed to "todo" we set completedAt to null (since it's not done yet).
body.completedAt = null;
const statusChanged = data.status && action.status !== data.status;
if (statusChanged) {
if ([DONE, CANCEL].includes(data.status)) {
// When status changed to finished (done, cancel) completedAt we set it to now if not set.
body.completedAt = data.completedAt || now();
} else {
// When status just changed to "todo" we set completedAt to null (since it's not done yet).
body.completedAt = null;
}
}
if (data.completedAt && outOfBoundariesDate(data.completedAt)) return toast.error('La date de complétion est hors limites (entre 1900 et 2100)');
if (data.dueAt && outOfBoundariesDate(data.dueAt)) return toast.error("La date d'échéance est hors limites (entre 1900 et 2100)");
Expand Down

0 comments on commit 3c433f0

Please sign in to comment.