const app = getApp() Page({ data: { accuracy: 95, timeUsed: '12:45', total: 50, mastered: 20, reviewNeeded: 5, }, onLoad() { const session = app.globalData.reviewSession const total = session.deck.length || this.data.total const correct = session.correctCount || 0 const accuracy = total ? Math.round((correct / total) * 100) : this.data.accuracy this.setData({ accuracy, total, mastered: correct, reviewNeeded: session.wrongCount || this.data.reviewNeeded, }) }, restart() { app.globalData.reviewSession = { deck: [], currentIndex: 0, correctCount: 0, wrongCount: 0, completed: false, currentAnswer: '' } wx.reLaunch({ url: '/pages/review-config/review-config' }) }, goHome() { wx.reLaunch({ url: '/pages/index/index' }) }, })