U
    Sh                     @   s  d dl mZmZ d dlZd dlmZ d dlmZ e  edZ	e	seddZ
edd	Zed
dZeddZeddZde de de
 de de 
Z	ee	Zed e ZeedZe Zered ed ed ed eD ]>\ZZZZerend Zee deddedded qed  d  Ze Zed ede  ed e  eek ree jZed!e d" ed# ed$ ed%e  ed& ned' ned( W 5 Q R X dS ))    )create_enginetextN)load_dotenv)dateDATABASE_URLDB_HOSTZ	localhostDB_PORTZ5432DB_NAMEZtimesheet_dbDB_USERZpostgresDB_PASSWORD zpostgresql://:@/z)=== Finding Dates with Activity Data ===
aP  
        SELECT 
            DATE(timestamp) as activity_date,
            COUNT(DISTINCT developer_id) as developers,
            COUNT(*) as total_records,
            SUM(duration) / 3600 as total_hours
        FROM activity_records
        WHERE duration > 0
        GROUP BY DATE(timestamp)
        ORDER BY activity_date DESC
    zDates with activity data:z2==================================================z/Date       | Developers | Records | Total Hoursz2--------------------------------------------------z | Z107z10.1fz3
==================================================u   📅 Today's date: u   📊 Latest data: u   
⚠️ Your data is z
 days old!u   
🔧 TO FIX THE DASHBOARD:z01. Click the date picker in the top-right cornerz2. Select: z&3. Your hours will appear immediately!u   
✅ You have data for today!u+   ❌ No activity data found in the database!) Z
sqlalchemyr   r   osZdotenvr   Zdatetimer   getenvr   r   r   r	   r
   r   ZengineprintZconnectZconnZexecuteresultZfetchallZdatesZact_dateZdevsZrecordsZhoursZ	hours_valZlatest_dateZtodayZdaysZ	days_diff r   r   ./find_data_dates.py<module>   sN   
"&



