mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Improve handling of yearly data to correctly process all years
Update year calculations to accurately reflect week and month assignments, particularly for transitional periods between years, and enhance API logging for debugging. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 0ec86cdf-a5be-4b0e-84a3-07b926f5cc80 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/0ec86cdf-a5be-4b0e-84a3-07b926f5cc80/ZJYssQp
This commit is contained in:
1 parent
55afb8eb70
commit
19c41f11c3
3 files changed
+40
-56
No files matched your search
+7
-1
@@ -2224,6 +2224,9 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
const { year, storeId } = req.query;
|
||||
const filterYear = year ? parseInt(year as string) : undefined;
|
||||
|
||||
// DEBUG: Log pour identifier le problème avec 2025
|
||||
console.log(`📋 API PUBLICITIES REQUEST:`, { year, filterYear, storeId, userRole: user.role });
|
||||
|
||||
let groupIds: number[] | undefined;
|
||||
|
||||
if (user.role === 'admin') {
|
||||
@@ -2234,10 +2237,13 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
groupIds = user.userGroups.map(ug => ug.groupId);
|
||||
}
|
||||
|
||||
console.log(`📋 CALLING storage.getPublicities:`, { filterYear, groupIds });
|
||||
const publicities = await storage.getPublicities(filterYear, groupIds);
|
||||
console.log(`📋 PUBLICITIES RETURNED:`, { count: publicities.length });
|
||||
|
||||
res.json(publicities);
|
||||
} catch (error) {
|
||||
console.error("Error fetching publicities:", error);
|
||||
console.error(`❌ ERROR fetching publicities for year ${year}:`, error);
|
||||
res.status(500).json({ message: "Failed to fetch publicities", error: (error as Error).message });
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user