Fix bug when filtering only manual sessions (#51)
This commit is contained in:
parent
9d2a0ace33
commit
8ba5344a4d
|
@ -3,6 +3,7 @@
|
||||||
* Improve form appearance
|
* Improve form appearance
|
||||||
* Add helper buttons next to datime fields
|
* Add helper buttons next to datime fields
|
||||||
* Change recent session view to current year instead of last 30 days
|
* Change recent session view to current year instead of last 30 days
|
||||||
|
* Fix bug when filtering only manual sessions (https://git.kucharczyk.xyz/lukas/timetracker/issues/51)
|
||||||
|
|
||||||
## 1.0.3 / 2023-02-20 17:16+01:00
|
## 1.0.3 / 2023-02-20 17:16+01:00
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="text-center text-xl mb-4 dark:text-slate-400">
|
<div class="text-center text-xl mb-4 dark:text-slate-400">
|
||||||
{% if dataset.count >= 2 %}
|
{% if chart %}
|
||||||
<img src="data:image/svg+xml;base64,{{ chart|safe }}" class="mx-auto mb-3" />
|
<img src="data:image/svg+xml;base64,{{ chart|safe }}" class="mx-auto mb-3" />
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if dataset.count >= 1 %}
|
{% if dataset.count >= 1 %}
|
||||||
|
|
|
@ -181,8 +181,9 @@ def list_sessions(
|
||||||
context["dataset"] = dataset
|
context["dataset"] = dataset
|
||||||
# cannot use dataset[0] here because that might be only partial QuerySet
|
# cannot use dataset[0] here because that might be only partial QuerySet
|
||||||
context["last"] = Session.objects.all().order_by("timestamp_start").last()
|
context["last"] = Session.objects.all().order_by("timestamp_start").last()
|
||||||
|
# only if 2 or more non-manual sessions exist
|
||||||
|
if dataset.filter(timestamp_end__isnull=False).count() >= 2:
|
||||||
# charts are always oldest->newest
|
# charts are always oldest->newest
|
||||||
if dataset.count() >= 2:
|
|
||||||
context["chart"] = playtime_over_time_chart(dataset.order_by("timestamp_start"))
|
context["chart"] = playtime_over_time_chart(dataset.order_by("timestamp_start"))
|
||||||
|
|
||||||
return render(request, "list_sessions.html", context)
|
return render(request, "list_sessions.html", context)
|
||||||
|
|
Loading…
Reference in New Issue