attendace, user stats
This commit is contained in:
1 parent
d6a77fcd23
commit
3e30fae173
7 files changed
+30
-16
No files matched your search
@@ -80,7 +80,8 @@ export async function GET(
|
||||
}
|
||||
|
||||
// Get recent activity (attendance in last 30 days)
|
||||
const thirtyDaysAgo = Date.now() - 30 * 24 * 60 * 60 * 1000;
|
||||
// Database stores timestamps in seconds, so convert milliseconds to seconds
|
||||
const thirtyDaysAgo = Math.floor(Date.now() / 1000) - 30 * 24 * 60 * 60;
|
||||
const attendanceResult = (await db.all(
|
||||
sql`SELECT COUNT(*) as count FROM attendance
|
||||
WHERE user_id IN (SELECT id FROM users WHERE gym_id = ${gymId})
|
||||
|
||||
@@ -69,16 +69,16 @@ export default function AttendancePage() {
|
||||
{record.type}
|
||||
</td>
|
||||
<td className="py-3 px-4 text-sm text-muted-foreground">
|
||||
{new Date(record.checkIn).toLocaleString()}
|
||||
{new Date(record.checkInTime).toLocaleString()}
|
||||
</td>
|
||||
<td className="py-3 px-4 text-sm text-muted-foreground">
|
||||
{record.checkOut
|
||||
? new Date(record.checkOut).toLocaleString()
|
||||
{record.checkOutTime
|
||||
? new Date(record.checkOutTime).toLocaleString()
|
||||
: "-"}
|
||||
</td>
|
||||
<td className="py-3 px-4">
|
||||
<Badge variant={record.checkOut ? "gray" : "success"}>
|
||||
{record.checkOut ? "Completed" : "Active"}
|
||||
<Badge variant={record.checkOutTime ? "gray" : "success"}>
|
||||
{record.checkOutTime ? "Completed" : "Active"}
|
||||
</Badge>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in new issue
Block a user