Ensure task list sorts correctly by number from smallest to largest

Fix task sorting by casting the publication number to an integer for accurate numerical ordering and update logging for better debugging insight.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 2e1318c6-77b3-4174-b8c7-432d781590ed
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/2e1318c6-77b3-4174-b8c7-432d781590ed/sW3Ppp1
This commit is contained in:
michaelschal committed 2025-08-21 10:53:36 +00:00
1 parent 372b67429b
commit ceebe73b91
2 files changed
+7 -6

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 KiB

+7 -6
View File
@@ -1209,13 +1209,14 @@ export class DatabaseStorage implements IStorage {
query = query.where(eq(publicities.year, year));
}
const results = await query.orderBy(asc(publicities.pubNumber));
const results = await query.orderBy(sql`CAST(${publicities.pubNumber} AS INTEGER) ASC`);
// LOG: Debug du tri des publicités
console.log(`📋 PUBLICITES: Tri par pubNumber croissant - ${results.length} résultats:`,
results.slice(0, 3).map(p => `N°${p.pubNumber}(${p.designation})`).join(', ') +
(results.length > 3 ? '...' : '')
);
// LOG: Debug du tri des publicités avec détails complets
console.log(`📋 PUBLICITES: Tri par pubNumber croissant (CAST AS INTEGER) - ${results.length} résultats:`);
console.log('🔍 PREMIERS RESULTATS:', results.slice(0, 5).map((p, i) => `${i+1}. N°${p.pubNumber} - ${p.designation}`));
if (results.length > 5) {
console.log('🔍 DERNIERS RESULTATS:', results.slice(-2).map((p, i) => `${results.length-1+i}. N°${p.pubNumber} - ${p.designation}`));
}
const publicityIds = results.map((p: any) => p.id);
const participations = publicityIds.length > 0