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);
|
||||
if (!entry) return;
|
||||
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 = {
|
||||
...entry,
|
||||
status: "inchis",
|
||||
trackedDeadlines: resolvedDeadlines,
|
||||
updatedAt: now,
|
||||
};
|
||||
await saveEntry(storage, blobStorage, closedMain);
|
||||
@@ -141,13 +151,19 @@ export function useRegistry() {
|
||||
const saves = linked
|
||||
.map((linkedId) => entries.find((e) => e.id === linkedId))
|
||||
.filter((e): e is RegistryEntry => !!e && e.status !== "inchis")
|
||||
.map((e) =>
|
||||
saveEntry(storage, blobStorage, {
|
||||
.map((e) => {
|
||||
const resolvedDls = (e.trackedDeadlines ?? []).map((dl) =>
|
||||
dl.resolution === "pending"
|
||||
? resolveDeadlineFn(dl, "completed", "Rezolvat automat la închiderea înregistrării")
|
||||
: dl,
|
||||
);
|
||||
return saveEntry(storage, blobStorage, {
|
||||
...e,
|
||||
status: "inchis",
|
||||
trackedDeadlines: resolvedDls,
|
||||
updatedAt: now,
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
await Promise.all(saves);
|
||||
}
|
||||
await refresh();
|
||||
|
||||
@@ -246,6 +246,9 @@ export function groupDeadlinesByEntry(
|
||||
const groups: DeadlineEntryGroup[] = [];
|
||||
|
||||
for (const entry of entries) {
|
||||
// Skip closed entries — their deadlines are no longer actionable
|
||||
if (entry.status === "inchis") continue;
|
||||
|
||||
const deadlines = entry.trackedDeadlines ?? [];
|
||||
if (deadlines.length === 0) continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user