Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Day Calculation Logic for Stats Page #3777

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion client/components/stats/Heatmap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,17 @@ export default {
let maxValue = 0
let minValue = 0

const wholeYearDays = (52 * 7 + this.dayOfWeekToday);
const wholeYear = this.$addDaysToToday(-wholeYearDays + 1)

for (let i = 0; i < wholeYearDays; i++) {
const date = i === 0 ? wholeYear : this.$addDaysToDate(wholeYear, i)
const dateString = this.$formatJsDate(date, 'yyyy-MM-dd')
if ((this.daysListening[dateString] || 0) > 0) {
this.daysListenedInTheLastYear++
}
}

const dates = []
for (let i = 0; i < this.daysToShow + 1; i++) {
const date = i === 0 ? this.firstWeekStart : this.$addDaysToDate(this.firstWeekStart, i)
Expand All @@ -215,7 +226,6 @@ export default {
dates.push(dateObj)

if (dateObj.value > 0) {
this.daysListenedInTheLastYear++
if (dateObj.value > maxValue) maxValue = dateObj.value
if (!minValue || dateObj.value < minValue) minValue = dateObj.value
}
Expand Down
Loading