WIP reporting on actions taken

This commit is contained in:
2026-06-16 09:15:18 -04:00
parent b2f84a27cd
commit bc3e178676
2 changed files with 15 additions and 3 deletions

10
app.py
View File

@@ -94,6 +94,7 @@ def generate_report(user_id, begin_date, end_date):
conn.close()
total_seconds = 0
paid_seconds = 0
actions = []
for row in rows:
timestamp = parse_iso_datetime(row["ts"])
if timestamp < begin_dt or timestamp > end_dt:
@@ -103,9 +104,11 @@ def generate_report(user_id, begin_date, end_date):
paid_seconds += delta.total_seconds()
else:
total_seconds += delta.total_seconds()
if row["comments"]:
actions.append(row["comments"])
total_hours = total_seconds / 3600.0
paid_hours = paid_seconds / 3600.0
return round(total_hours, 2), round(paid_hours, 2)
return round(total_hours, 2), round(paid_hours, 2), actions
@app.route("/", methods=["GET", "POST"])
def index():
@@ -176,7 +179,7 @@ def index():
elif action == "report":
begin_date = request.form.get("begin_date")
end_date = request.form.get("end_date")
report_hours = generate_report(
report_hours, paid_hours, actions = generate_report(
selected_user_id,
begin_date,
end_date
@@ -194,7 +197,8 @@ def index():
"id": user["id"],
"name": user["name"],
"total_hours": total_hours,
"paid_hours": paid_hours
"paid_hours": paid_hours,
"actions": actions
})
return render_template(
"index.html",