fix: closed entries no longer show in deadline dashboard
- groupDeadlinesByEntry skips entries with status "inchis" - closeEntry auto-resolves all pending deadlines on close (main + linked) - Fixes S-2026-00001 showing as overdue despite being closed Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -130,9 +130,19 @@ export function useRegistry() {
|
|||||||
const entry = entries.find((e) => e.id === id);
|
const entry = entries.find((e) => e.id === id);
|
||||||
if (!entry) return;
|
if (!entry) return;
|
||||||
const now = new Date().toISOString();
|
const now = new Date().toISOString();
|
||||||
|
|
||||||
|
// Auto-resolve all pending deadlines when closing an entry
|
||||||
|
const resolvedDeadlines = (entry.trackedDeadlines ?? []).map((dl) => {
|
||||||
|
if (dl.resolution === "pending") {
|
||||||
|
return resolveDeadlineFn(dl, "completed", "Rezolvat automat la închiderea înregistrării");
|
||||||
|
}
|
||||||
|
return dl;
|
||||||
|
});
|
||||||
|
|
||||||
const closedMain: RegistryEntry = {
|
const closedMain: RegistryEntry = {
|
||||||
...entry,
|
...entry,
|
||||||
status: "inchis",
|
status: "inchis",
|
||||||
|
trackedDeadlines: resolvedDeadlines,
|
||||||
updatedAt: now,
|
updatedAt: now,
|
||||||
};
|
};
|
||||||
await saveEntry(storage, blobStorage, closedMain);
|
await saveEntry(storage, blobStorage, closedMain);
|
||||||
@@ -141,13 +151,19 @@ export function useRegistry() {
|
|||||||
const saves = linked
|
const saves = linked
|
||||||
.map((linkedId) => entries.find((e) => e.id === linkedId))
|
.map((linkedId) => entries.find((e) => e.id === linkedId))
|
||||||
.filter((e): e is RegistryEntry => !!e && e.status !== "inchis")
|
.filter((e): e is RegistryEntry => !!e && e.status !== "inchis")
|
||||||
.map((e) =>
|
.map((e) => {
|
||||||
saveEntry(storage, blobStorage, {
|
const resolvedDls = (e.trackedDeadlines ?? []).map((dl) =>
|
||||||
|
dl.resolution === "pending"
|
||||||
|
? resolveDeadlineFn(dl, "completed", "Rezolvat automat la închiderea înregistrării")
|
||||||
|
: dl,
|
||||||
|
);
|
||||||
|
return saveEntry(storage, blobStorage, {
|
||||||
...e,
|
...e,
|
||||||
status: "inchis",
|
status: "inchis",
|
||||||
|
trackedDeadlines: resolvedDls,
|
||||||
updatedAt: now,
|
updatedAt: now,
|
||||||
}),
|
});
|
||||||
);
|
});
|
||||||
await Promise.all(saves);
|
await Promise.all(saves);
|
||||||
}
|
}
|
||||||
await refresh();
|
await refresh();
|
||||||
|
|||||||
@@ -246,6 +246,9 @@ export function groupDeadlinesByEntry(
|
|||||||
const groups: DeadlineEntryGroup[] = [];
|
const groups: DeadlineEntryGroup[] = [];
|
||||||
|
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
|
// Skip closed entries — their deadlines are no longer actionable
|
||||||
|
if (entry.status === "inchis") continue;
|
||||||
|
|
||||||
const deadlines = entry.trackedDeadlines ?? [];
|
const deadlines = entry.trackedDeadlines ?? [];
|
||||||
if (deadlines.length === 0) continue;
|
if (deadlines.length === 0) continue;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user