Fixc weekly graph

This commit is contained in:
Peter Stockings
2024-12-30 23:29:30 +11:00
parent ea0ad126ab
commit 68c8059466
2 changed files with 36 additions and 20 deletions

View File

@@ -148,13 +148,11 @@
<!-- Weekly View -->
<div x-show="activeView === 'weekly'" class="grid grid-cols-7 text-center">
{% set today = date.today() %}
{% for i in range(7) %}
{% set day = today - timedelta(days=today.weekday() - i) %}
{% for day in week %}
<div class="border p-1 md:p-4 bg-gray-50">
<div class="text-sm font-bold text-gray-500">{{ day.strftime('%a, %b %d') }}</div>
{% if day in readings_by_date %}
{% for reading in readings_by_date[day]|sort(attribute="timestamp", reverse = True) %}
<div class="text-sm font-bold text-gray-500">{{ day.date }}</div>
{% if day.readings %}
{% for reading in day.readings %}
<a href="{{ url_for('reading.edit_reading', reading_id=reading.id) }}"
class="block mt-2 p-0 md:p-2 bg-green-100 rounded-lg shadow hover:bg-green-200 transition">
<p class="text-xs font-medium text-green-800">