Improve signature parsing and updating logic

This commit is contained in:
2025-06-17 14:27:46 +02:00
parent 927eae06c3
commit 7af1ced1a7

View File

@@ -37,9 +37,11 @@ export const SystemView = () => {
const updatedSignature: Pick<Signature, 'updated' | 'type' | 'signame' | 'scanned'> = { const updatedSignature: Pick<Signature, 'updated' | 'type' | 'signame' | 'scanned'> = {
updated: new Date().toISOString() updated: new Date().toISOString()
} }
if (existingRecord.type == "" && signature.type != "") // Existing record has no type and our new signature has a type
if (!!!existingRecord.type && !!signature.type)
updatedSignature.type = signature.type; updatedSignature.type = signature.type;
if (existingRecord.signame == "" && signature.signame != "") // Existing record has no signame and our new signature has a signame
if (!!!existingRecord.signame && !!signature.signame)
updatedSignature.signame = signature.signame; updatedSignature.signame = signature.signame;
// Update existing signature only if new scan percentage is higher // Update existing signature only if new scan percentage is higher
const existingScannedPercentage = parseScannedPercentage(existingRecord.scanned); const existingScannedPercentage = parseScannedPercentage(existingRecord.scanned);