Renommer la fonction de connexion à la base de données et améliorer la gestion des erreurs. Nettoyer le code en supprimant les commentaires inutiles et réinitialiser le compteur après la journalisation des modifications.

This commit is contained in:
2025-04-03 09:07:45 +02:00
parent a33e517a8a
commit 242bbcd597
2 changed files with 4 additions and 5 deletions

View File

@@ -16,9 +16,7 @@ async function checkAndRemoveInvalidEntries() {
}
}
// Scan all images in storage
const allImages = await storageManager.scanAllImages();
//console.log('Scanned all images:', allImages);
for (const imagePath of allImages) {
const entryRes = await db.query('SELECT id FROM measurements WHERE path = $1', [imagePath]);
if (entryRes.rows.length === 0) {
@@ -29,6 +27,7 @@ async function checkAndRemoveInvalidEntries() {
}
if (localCounter > 0) {
console.log(`[INFO] ${localCounter} entrées ont été modifiées`);
localCounter = 0; // Reset the counter after logging
}
} catch (err) {
console.error('Error checking and removing invalid entries:', err);