add 5-second auto-refresh to all views except work and workmonth

Implements conditional auto-refresh using meta http-equiv tags in templates.
Views with auto_refresh=True will reload every 5 seconds to show updated data.
Work and workmonth views excluded to avoid disrupting focused work sessions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
buenosairesam
2025-10-14 01:25:39 -03:00
parent 5007f241dd
commit 422c4e2776
4 changed files with 15 additions and 8 deletions

View File

@@ -35,7 +35,7 @@ def index(task=None):
print(rows)
return render_template("main.html", rows=rows, current_task_path=current_task_path, current_task_time=current_task_time)
return render_template("main.html", rows=rows, current_task_path=current_task_path, current_task_time=current_task_time, auto_refresh=True)
@dmbp.route("/day/<int:month>/<int:day>")
@@ -57,7 +57,7 @@ def oneday(
rows = get_period_totals(start, end)
return render_template("pages.html", rows=rows)
return render_template("pages.html", rows=rows, auto_refresh=True)
@dmbp.route("/period/<start>/<end>")
@@ -72,7 +72,7 @@ def period(start, end):
rows = get_period_totals(start, end)
return render_template("pages.html", rows=rows)
return render_template("pages.html", rows=rows, auto_refresh=True)
@dmbp.route("/work")
@@ -86,7 +86,7 @@ def work():
rows = get_work_period_totals(start, end)
print(rows)
return render_template("main.html", rows=rows)
return render_template("main.html", rows=rows, auto_refresh=False)
@dmbp.route("/totals")
@@ -104,4 +104,4 @@ def totals(task=None):
rows = get_period_totals(start, end)
return render_template("pages.html", rows=rows)
return render_template("pages.html", rows=rows, auto_refresh=True)

View File

@@ -148,7 +148,7 @@ def workmonth(month=None, year=None):
cal.setcalmonth(usemonth)
cal.setcalyear(useyear)
return render_template("calendar.html", content=cal.formatmonth(useyear, usemonth))
return render_template("calendar.html", content=cal.formatmonth(useyear, usemonth), auto_refresh=False)
@dmbp.route("/month")
@@ -174,4 +174,4 @@ def month(month=None, year=None, task=None):
cal.setcalmonth(usemonth)
cal.setcalyear(useyear)
return render_template("calendar.html", content=cal.formatmonth(useyear, usemonth))
return render_template("calendar.html", content=cal.formatmonth(useyear, usemonth), auto_refresh=True)

View File

@@ -5,6 +5,10 @@
<link rel="stylesheet" href="{{ url_for('static', filename='styles/dm.css') }}">
-->
{% if auto_refresh %}
<meta http-equiv="refresh" content="5">
{% endif %}
{% block head %}
{% endblock %}

View File

@@ -1,6 +1,9 @@
<html>
<head>
<!-- <link rel="stylesheet" href="{{ url_for('static', filename='styles/dm.css') }}"> -->
{% if auto_refresh %}
<meta http-equiv="refresh" content="5">
{% endif %}
{% block head %}
{% endblock %}