-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_db_state.sql
More file actions
31 lines (28 loc) · 846 Bytes
/
Copy pathcheck_db_state.sql
File metadata and controls
31 lines (28 loc) · 846 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
-- Check current database state for debugging
-- Run this in Supabase SQL Editor to see what's in the database
-- Check today's attendance_days records
SELECT
p.full_name,
ad.date,
ad.check_in_at,
ad.check_out_at,
ad.status
FROM attendance_days ad
JOIN people p ON ad.person_id = p.id
WHERE ad.date = CURRENT_DATE
ORDER BY p.full_name;
-- Check recent attendance_events (last 20)
SELECT
p.full_name,
ae.event_type,
ae.occurred_at,
ae.source
FROM attendance_events ae
JOIN people p ON ae.person_id = p.id
WHERE ae.occurred_at::date = CURRENT_DATE
ORDER BY ae.occurred_at DESC
LIMIT 20;
-- Count records for today
SELECT
(SELECT COUNT(*) FROM attendance_days WHERE date = CURRENT_DATE) as days_count,
(SELECT COUNT(*) FROM attendance_events WHERE occurred_at::date = CURRENT_DATE) as events_count;