fix: reclassify BU reassignment round-trips and fix backfill date-ordering bug
This commit is contained in:
@@ -315,10 +315,11 @@ async function detectArchiveChanges(db, previousFindings, currentFindings) {
|
||||
const returnClassification = { bu_reassignment: 0, severity_drift: 0, closed_on_platform: 0, decommissioned: 0 };
|
||||
for (const archiveId of returnedArchiveIds) {
|
||||
try {
|
||||
// Find the most recent ARCHIVED transition reason for this archive record
|
||||
// Find the most recent ARCHIVED transition reason *before* this return
|
||||
const transition = await dbGet(db,
|
||||
`SELECT reason FROM ivanti_archive_transitions
|
||||
WHERE archive_id = ? AND to_state = 'ARCHIVED'
|
||||
AND transitioned_at <= datetime('now')
|
||||
ORDER BY transitioned_at DESC LIMIT 1`,
|
||||
[archiveId]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user