Improve signature parsing and updating logic
This commit is contained in:
@@ -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);
|
||||||
|
Reference in New Issue
Block a user