diff --git a/cookies.txt b/cookies.txt index 7791439..c951897 100644 --- a/cookies.txt +++ b/cookies.txt @@ -2,4 +2,4 @@ # https://curl.se/docs/http-cookies.html # This file was generated by libcurl! Edit at your own risk. -#HttpOnly_localhost FALSE / FALSE 1755173643 connect.sid s%3ARJVevhpqKq9drfbbR46G-2Ll2WIWg2Es.qOQvBzSdDPOh9zhkIbeCCSRmumFEtIy1LT2pYBPaEck +#HttpOnly_localhost FALSE / FALSE 1755173847 connect.sid s%3ANh8VuEqk2J-ItTNJEGOkI2oMijs2phlk.d7750iTT0H6Yxgo2fS9Uglu%2F5iyGWhbnHDT4H50h7zU diff --git a/server/storage.ts b/server/storage.ts index 27f0951..99aa7c9 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -613,12 +613,12 @@ export class DatabaseStorage implements IStorage { // Construire les conditions pour le filtrage par groupe let ordersWhereCondition = and( - gte(orders.plannedDate, new Date(startDate)), - lt(orders.plannedDate, new Date(endDate)) + gte(orders.plannedDate, startDate), + lt(orders.plannedDate, endDate) ); let deliveriesWhereCondition = and( - gte(deliveries.plannedDate, new Date(startDate)), - lt(deliveries.plannedDate, new Date(endDate)) + gte(deliveries.scheduledDate, startDate), + lt(deliveries.scheduledDate, endDate) ); // Ajouter le filtre par groupe si spécifié @@ -640,12 +640,9 @@ export class DatabaseStorage implements IStorage { .where(deliveriesWhereCondition); // Commandes en attente (sans date de livraison ou pas encore livrées) - let pendingWhereCondition = or( - isNull(orders.plannedDate), - eq(orders.status, 'pending') - ); + let pendingWhereCondition = eq(orders.status, 'pending'); if (groupIds && groupIds.length > 0) { - pendingWhereCondition = and(pendingWhereCondition, inArray(orders.groupId, groupIds)); + pendingWhereCondition = and(pendingWhereCondition, inArray(orders.groupId, groupIds)) as any; } const pendingResult = await db @@ -658,12 +655,12 @@ export class DatabaseStorage implements IStorage { .select({ totalPalettes: sql`COALESCE(SUM(CAST(${deliveries.quantity} as INTEGER)), 0)`, totalPackages: sql`COALESCE(COUNT(*), 0)`, - avgDelay: sql`COALESCE(AVG(EXTRACT(DAY FROM (${deliveries.actualDate} - ${deliveries.plannedDate}))), 0)` + avgDelay: sql`COALESCE(AVG(EXTRACT(DAY FROM (${deliveries.deliveredDate} - ${deliveries.scheduledDate}))), 0)` }) .from(deliveries) .where(and( deliveriesWhereCondition, - isNotNull(deliveries.actualDate) + isNotNull(deliveries.deliveredDate) )); const ordersCount = Number(ordersResult[0]?.count || 0); @@ -743,8 +740,8 @@ export class DatabaseStorage implements IStorage { return results.map((publicity: any) => ({ ...publicity, participations: participations - .filter((p) => p.publicityId === publicity.id) - .map((p) => ({ + .filter((p: any) => p.publicityId === publicity.id) + .map((p: any) => ({ publicityId: p.publicityId, groupId: p.groupId, group: p.group!, @@ -768,7 +765,7 @@ export class DatabaseStorage implements IStorage { return { ...publicity, - participations: participations.map(p => ({ + participations: participations.map((p: any) => ({ publicityId: p.publicityId, groupId: p.groupId, group: p.group!, @@ -1015,7 +1012,7 @@ export class MemStorage implements IStorage { lastName: userData.lastName || null, profileImageUrl: userData.profileImageUrl || null, password: userData.password || null, - role: userData.role, + role: userData.role || 'user', passwordChanged: userData.passwordChanged || false, createdAt: existingUser?.createdAt || new Date(), updatedAt: new Date(),