Jun 29 - Admin view user's notes
This commit is contained in:
@@ -1647,6 +1647,42 @@ def purge_app_log(older_than_days: int = 30):
|
||||
conn.close()
|
||||
|
||||
|
||||
# ─── Today's Check Notes ──────────────────────────────────────────────────────
|
||||
|
||||
def get_todays_check_notes() -> list:
|
||||
"""Return all shift_checks from today that have a non-empty user_note."""
|
||||
conn = None
|
||||
try:
|
||||
conn = get_connection()
|
||||
cur = conn.cursor(dictionary=True)
|
||||
cur.execute(
|
||||
"""
|
||||
SELECT
|
||||
sc.id AS check_id,
|
||||
sc.checked_at,
|
||||
sc.user_note,
|
||||
w.id AS website_id,
|
||||
w.name AS website_name,
|
||||
w.url AS website_url,
|
||||
COALESCE(u.full_name, u.username) AS full_name,
|
||||
u.username
|
||||
FROM shift_checks sc
|
||||
JOIN websites w ON w.id = sc.website_id
|
||||
JOIN users u ON u.id = sc.user_id
|
||||
WHERE DATE(sc.checked_at) = CURDATE()
|
||||
AND sc.user_note IS NOT NULL
|
||||
AND TRIM(sc.user_note) <> ''
|
||||
ORDER BY sc.checked_at DESC
|
||||
"""
|
||||
)
|
||||
rows = cur.fetchall()
|
||||
cur.close()
|
||||
return rows
|
||||
finally:
|
||||
if conn:
|
||||
conn.close()
|
||||
|
||||
|
||||
# ─── Missed Shifts ────────────────────────────────────────────────────────────
|
||||
|
||||
def get_missed_shifts_today() -> list:
|
||||
|
||||
Reference in New Issue
Block a user