Fix error when generating charts with less than 2 entries
This commit is contained in:
parent
5e54871374
commit
376beea02f
|
@ -156,7 +156,7 @@ def list_sessions(
|
|||
# cannot use dataset[0] here because that might be only partial QuerySet
|
||||
context["last"] = Session.objects.all().order_by("timestamp_start").last()
|
||||
# charts are always oldest->newest
|
||||
if Session.objects.count() >= 2:
|
||||
if dataset.count() >= 2:
|
||||
context["chart"] = playtime_over_time_chart(dataset.order_by("timestamp_start"))
|
||||
|
||||
return render(request, "list_sessions.html", context)
|
||||
|
|
Loading…
Reference in New Issue