From 15187fd32c56ef54ab9467cd24222edf22488daf Mon Sep 17 00:00:00 2001 From: Hojagulyyev Date: Wed, 13 Dec 2023 18:06:02 +0500 Subject: [PATCH] fix(clans): fix 31 days account report via account new 31 method --- apps/accounts/models.py | 10 ++++++++-- templates/clans/overview.html | 10 +++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/apps/accounts/models.py b/apps/accounts/models.py index 0a34937..5761f47 100644 --- a/apps/accounts/models.py +++ b/apps/accounts/models.py @@ -17,10 +17,16 @@ class Account(models.Model): def __str__(self): return self.user.username - def get_xp_daily_report(self): + def get_xp_10daily_report(self): return [ diary.get_earned_xp() - for diary in self.diaries.order_by("-created_date")[:30] + for diary in self.diaries.order_by("-created_date")[:10] + ][::-1] + + def get_xp_31daily_report(self): + return [ + diary.get_earned_xp() + for diary in self.diaries.order_by("-created_date")[:31] ][::-1] def get_full_name(self): diff --git a/templates/clans/overview.html b/templates/clans/overview.html index 03a5b2e..39d84f7 100644 --- a/templates/clans/overview.html +++ b/templates/clans/overview.html @@ -289,7 +289,7 @@

Overview

-

Reports for the last 30 days by Diary's XP

+

Reports for the last 31 days by Diary's XP

@@ -327,7 +327,7 @@

Overview

- +
@@ -388,7 +388,7 @@

Overview

app.querySelector('#accounts-10day-report-chart', function (el) { const {% for account in top_accounts %} - datasetData{{ forloop.counter }} = {{ account.get_xp_daily_report }}, + datasetData{{ forloop.counter }} = {{ account.get_xp_10daily_report }}, {% endfor %} canvas = el[0], @@ -494,10 +494,10 @@

Overview

}); -app.querySelector('#accounts-30day-report-chart', function (el) { +app.querySelector('#accounts-31day-report-chart', function (el) { const {% for account in top_accounts %} - datasetData{{ forloop.counter }} = {{ account.get_xp_daily_report }}, + datasetData{{ forloop.counter }} = {{ account.get_xp_31daily_report }}, {% endfor %} canvas = el[0],