Enhance milestone progress calculation and logging: Add detailed logging for the milestone progress function to aid in debugging and improve handling of cases with no dashboard data. Update HTML to display progress with two decimal places for better precision.

This commit is contained in:
padreug 2025-06-22 21:39:23 +02:00
parent 0962573176
commit a042745c04
2 changed files with 11 additions and 6 deletions

View file

@ -199,13 +199,18 @@ window.app = Vue.createApp({
},
getMilestoneProgress() {
if (!this.dashboardData) return 0
if (!this.dashboardData) {
console.log('getMilestoneProgress: no dashboard data')
return 0
}
const sats = this.dashboardData.total_sats_accumulated
const milestone = this.getNextMilestone()
// Show total progress toward the next milestone (from 0)
const progress = (sats / milestone.target) * 100
return Math.min(Math.max(progress, 0), 100)
const result = Math.min(Math.max(progress, 0), 100)
console.log('getMilestoneProgress:', { sats, milestone, progress, result })
return result
},
async loadChartData() {
// Prevent multiple simultaneous requests