diff --git a/app.py b/app.py index d118c73..a4e9335 100644 --- a/app.py +++ b/app.py @@ -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", diff --git a/templates/index.html b/templates/index.html index 69609d2..032b486 100644 --- a/templates/index.html +++ b/templates/index.html @@ -39,6 +39,7 @@ User Total Hours Worked Paid Hours + Actions {% for report in all_user_reports %} @@ -46,6 +47,13 @@ {{ report.name }} {{ report.total_hours }} {{ report.paid_hours }} + + + {% endfor %}