show already completed tasks

This commit is contained in:
2026-02-10 20:02:16 +01:00
parent 9ef70e0436
commit 9a0adbf05c
7 changed files with 604 additions and 375 deletions

19
app.py
View File

@@ -188,9 +188,10 @@ def start_timer_bg(activity_id):
'user_id': user_id,
'name': t['name'],
'activity_id': ObjectId(activity_id),
'time_entry_id': new_entry_id, # Link to this specific session
'time_entry_id': new_entry_id,
'status': 'open',
'is_template': False,
'source': 'auto', # Mark as auto-generated
'created_at': datetime.now(),
'comments': []
})
@@ -266,9 +267,10 @@ def toggle_timer(activity_id):
'user_id': user_id,
'name': t['name'],
'activity_id': ObjectId(activity_id),
'time_entry_id': new_entry_id, # Link to this specific session
'time_entry_id': new_entry_id,
'status': 'open',
'is_template': False,
'source': 'auto', # Mark as auto-generated
'created_at': datetime.now(),
'comments': []
})
@@ -327,13 +329,11 @@ def tasks():
activities = list(db.activities.find({'user_id': user_id}))
# Categorize tasks
# 1. Standalone / Manual Tasks
# Shows Manual Tasks (Open OR Completed). Hides "source: auto" (Session checklists)
tasks_list = list(db.tasks.find({
'user_id': user_id,
'is_template': False,
'time_entry_id': None, # Don't show session-specific generated tasks here to avoid clutter? or show all?
# Let's show manual tasks only. Session tasks are transient.
'status': 'open'
'source': {'$ne': 'auto'} # Show everything except explicitly auto-generated tasks
}).sort('due_date', 1))
# 2. Templates
@@ -364,6 +364,7 @@ def create_task():
'name': name,
'status': 'open',
'is_template': is_template,
'source': 'manual', # Mark as manually created
'created_at': datetime.now(),
'comments': []
}
@@ -454,8 +455,12 @@ def log_entry_detail(entry_id):
new_note = request.form.get('note')
start_str = request.form.get('start_time')
end_str = request.form.get('end_time')
subcategory = request.form.get('subcategory', '')
update_fields = {'note': new_note}
update_fields = {
'note': new_note,
'subcategory': subcategory
}
try:
if start_str: