mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-07 19:50:20 +00:00
cannot fix issue with elapsed timer on admin dashboard. fixing issues with QR code editing.
Grey = cant click Red = current Green = complete blue = skipped?
This commit is contained in:
1 parent
7d6b73ffb4
commit
0afa6817a8
12 files changed
+1529
-211
No files matched your search
@@ -218,19 +218,41 @@ export async function GET(request) {
|
||||
? huntActiveSetting.value === "true"
|
||||
: false;
|
||||
|
||||
// Use the actual timer status as the source of truth if it exists
|
||||
const isTimerActive = timerStatus ? !!timerStatus.active : false;
|
||||
|
||||
// Determine the actual active state by checking both sources
|
||||
// This ensures we don't miss an active timer due to inconsistent settings
|
||||
const isActuallyActive = huntActive || isTimerActive;
|
||||
|
||||
if (!timerStatus) {
|
||||
return Response.json({
|
||||
active: huntActive, // Use settings value if timer not found
|
||||
active: isActuallyActive,
|
||||
timerActive: false,
|
||||
startTime: null,
|
||||
endTime: null,
|
||||
serverTime: new Date().toISOString(),
|
||||
timestamp: Date.now(),
|
||||
});
|
||||
}
|
||||
|
||||
return Response.json({
|
||||
active: huntActive, // Return settings value for consistency
|
||||
timerActive: !!timerStatus.active, // Also return timer status for admin panel
|
||||
// Add cache-busting timestamp to ensure fresh data
|
||||
const responseData = {
|
||||
// Return consistent activity status from both sources
|
||||
active: isActuallyActive,
|
||||
timerActive: isTimerActive,
|
||||
startTime: timerStatus.start_time,
|
||||
endTime: timerStatus.end_time,
|
||||
serverTime: new Date().toISOString(),
|
||||
timestamp: Date.now(),
|
||||
};
|
||||
|
||||
return Response.json(responseData, {
|
||||
headers: {
|
||||
"Cache-Control": "no-store, no-cache, must-revalidate",
|
||||
Pragma: "no-cache",
|
||||
Expires: "0",
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Error getting timer status:", error);
|
||||
|
||||
Reference in new issue
Block a user