Posted January 29Jan 29 Challenge:Build a simple time tracking system that allows small businesses or freelancers to log work hours for projects and generate basic reports.Basic Requirements:✅ Start and Stop Tracking: Users can start and stop a work session.✅ Project-Based Logging: Assign time entries to specific projects or clients.✅ Daily & Weekly Reports: Summarize hours worked per project.Bonus Features for Small Business Needs:🔹 Invoice Generation: Convert time logs into invoices for clients.🔹 CSV/Excel Export: Allow users to export time reports.🔹 User Authentication: Let multiple users track their own hours.🔹 Idle Time Detection: Automatically detect inactivity.🔹 Mobile-Friendly Web UI: A simple frontend for easy access.Example Implementation (Python + SQLite for Local Storage)import sqlite3 import time # Initialize database conn = sqlite3.connect("time_tracking.db") cursor = conn.cursor() cursor.execute("""CREATE TABLE IF NOT EXISTS time_logs ( id INTEGER PRIMARY KEY AUTOINCREMENT, project TEXT, start_time REAL, end_time REAL )""") conn.commit() # Start tracking time def start_tracking(project): start_time = time.time() cursor.execute("INSERT INTO time_logs (project, start_time) VALUES (?, ?)", (project, start_time)) conn.commit() print(f"Tracking started for {project}") # Stop tracking time def stop_tracking(project): end_time = time.time() cursor.execute("UPDATE time_logs SET end_time = ? WHERE project = ? AND end_time IS NULL", (end_time, project)) conn.commit() print(f"Tracking stopped for {project}") # Generate a report def generate_report(): cursor.execute("SELECT project, SUM(end_time - start_time) FROM time_logs WHERE end_time IS NOT NULL GROUP BY project") results = cursor.fetchall() for project, total_time in results: print(f"Project: {project} | Hours: {total_time / 3600:.2f}") # Example usage start_tracking("Website Development") time.sleep(5) # Simulate work stop_tracking("Website Development") generate_report()
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.