feat: add Pomodoro timer functionality with logging and project goals
- Implemented Pomodoro timer in the app, allowing users to start, pause, and stop sessions. - Added context for managing Pomodoro state and actions. - Integrated time logging for completed sessions to track productivity. - Enhanced project settings to include time goals and Pomodoro settings. - Created migration scripts to update the database schema for new project fields and time logs. - Updated UI components to display Pomodoro controls and project time summaries. - Added category filtering for projects in the project list view.
This commit is contained in:
34
backend/migrate_add_time_logs.py
Normal file
34
backend/migrate_add_time_logs.py
Normal file
@@ -0,0 +1,34 @@
|
||||
"""
|
||||
Migration script to create the time_logs table.
|
||||
Run this once if you have an existing database.
|
||||
"""
|
||||
import sqlite3
|
||||
import os
|
||||
|
||||
db_path = os.path.join(os.path.dirname(__file__), 'bit.db')
|
||||
|
||||
if not os.path.exists(db_path):
|
||||
print("No migration needed - new database will be created with the correct schema.")
|
||||
exit(0)
|
||||
|
||||
conn = sqlite3.connect(db_path)
|
||||
cursor = conn.cursor()
|
||||
|
||||
try:
|
||||
cursor.execute("""
|
||||
CREATE TABLE IF NOT EXISTS time_logs (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
task_id INTEGER NOT NULL REFERENCES tasks(id) ON DELETE CASCADE,
|
||||
minutes INTEGER NOT NULL,
|
||||
note TEXT,
|
||||
session_type TEXT DEFAULT 'manual',
|
||||
logged_at DATETIME DEFAULT CURRENT_TIMESTAMP
|
||||
)
|
||||
""")
|
||||
conn.commit()
|
||||
print("Successfully created 'time_logs' table (or it already existed).")
|
||||
except Exception as e:
|
||||
print(f"Error during migration: {e}")
|
||||
conn.rollback()
|
||||
finally:
|
||||
conn.close()
|
||||
Reference in New Issue
Block a user