Skip to content

Commit

Permalink
fix(clans): fix 31 days account report via account new 31 method
Browse files Browse the repository at this point in the history
  • Loading branch information
Hojagulyyev committed Dec 13, 2023
1 parent 1d79d25 commit 15187fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
10 changes: 8 additions & 2 deletions apps/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions templates/clans/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ <h2 class="section-title">Overview</h2>
<!-- WIDGET BOX ACTION -->
<div class="widget-box-action">
<!-- WIDGET BOX TITLE -->
<p class="widget-box-title">Reports for the last 30 days by Diary's XP</p>
<p class="widget-box-title">Reports for the last 31 days by Diary's XP</p>
<!-- /WIDGET BOX TITLE -->
</div>
<!-- /WIDGET BOX ACTION -->
Expand Down Expand Up @@ -327,7 +327,7 @@ <h2 class="section-title">Overview</h2>
<div class="chart-wrap">
<!-- CHART -->
<div class="chart">
<canvas id="accounts-30day-report-chart"></canvas>
<canvas id="accounts-31day-report-chart"></canvas>
</div>
<!-- /CHART -->
</div>
Expand Down Expand Up @@ -388,7 +388,7 @@ <h2 class="section-title">Overview</h2>
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],
Expand Down Expand Up @@ -494,10 +494,10 @@ <h2 class="section-title">Overview</h2>
});


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],
Expand Down

0 comments on commit 15187fd

Please sign in to comment.