Daily Wellness & Productivity Log
Weekly Overview & Insights
Overview for Week:
Weekly Averages (1-5 Scale):
Average Productivity Level: N/A
Potential Correlations & Reflections:
Daily Logs for the Week:
No logs found for this week.
Select a week and click "Analyze Week" to view your overview.
No daily logs found for this week to generate insights.
'; mwpcWeeklyOverviewAreaEl.style.display = 'block'; mwpcDownloadReportBtnEl.style.display = 'none'; return; } mwpcNoLogsForWeekMessageEl.style.display = 'none'; const weeklyAverages = {}; mwpcWellnessFactorDefs.forEach(f => weeklyAverages[f.id] = { sum: 0, count: 0 }); let totalProductivitySum = 0, productivityCount = 0; logsForWeek.sort((a,b) => new Date(a.date) - new Date(b.date)).forEach(log => { const row = mwpcLogHistoryTableBodyEl.insertRow(); row.insertCell().textContent = new Date(log.date+'T00:00:00Z').toLocaleDateString(); mwpcWellnessFactorDefs.forEach(factor => { const score = log.wellnessScores[factor.id] || 0; row.insertCell().textContent = score; weeklyAverages[factor.id].sum += score; weeklyAverages[factor.id].count++; }); row.insertCell().textContent = log.productivityLevel; const notesCell = row.insertCell(); notesCell.textContent = log.notes.substring(0,25)+(log.notes.length>25?'...':''); notesCell.title = log.notes; // Full notes on hover notesCell.classList.add('notes-cell'); totalProductivitySum += log.productivityLevel; productivityCount++; }); let avgWellnessHTML = ''; const factorAveragesForChart = []; mwpcWellnessFactorDefs.forEach(f => { const avg = weeklyAverages[f.id].count > 0 ? (weeklyAverages[f.id].sum / weeklyAverages[f.id].count) : 0; avgWellnessHTML += `${f.label}: ${avg.toFixed(1)}
`; factorAveragesForChart.push({label: f.label, value: avg }); }); mwpcWeeklyAveragesDisplayEl.innerHTML = avgWellnessHTML; const avgProd = productivityCount > 0 ? (totalProductivitySum / productivityCount) : 0; mwpcAvgProdValueEl.textContent = avgProd.toFixed(1); mwpcRenderSimpleBarChart(factorAveragesForChart, avgProd); let insightsHTML = '- ';
const avgProdNum = parseFloat(avgProd);
mwpcWellnessFactorDefs.forEach(f => {
const avgFactorScore = weeklyAverages[f.id].count > 0 ? (weeklyAverages[f.id].sum / weeklyAverages[f.id].count) : null;
if(avgFactorScore !== null && !isNaN(avgProdNum)) {
let highMatches = 0; let lowMatches = 0;
logsForWeek.forEach(log => {
if(log.wellnessScores[f.id] >= 4 && log.productivityLevel >=4) highMatches++;
if(log.wellnessScores[f.id] <= 2 && log.productivityLevel <=2) lowMatches++;
});
if (highMatches >= 2 && highMatches > logsForWeek.length * 0.3) {
insightsHTML += `
- Observations suggest that higher levels of '${f.label}' often coincided with higher 'Productivity' this week. What contributed to these positive instances? `; } if (lowMatches >= 2 && lowMatches > logsForWeek.length * 0.3) { insightsHTML += `
- It was noted that lower '${f.label}' often appeared with lower 'Productivity' this week. Are there identifiable factors influencing these days? `; } } }); if(logsForWeek.filter(log => log.notes && (log.notes.toLowerCase().includes("stress") || log.notes.toLowerCase().includes("pressure"))).length >=1){ insightsHTML += `
- Your notes mentioned stress or pressure. Consider how these days correlated with your self-rated wellness and productivity scores. `; } if(insightsHTML === '
- Review your daily entries. Do you notice any connections between your wellness ratings, productivity, and daily events? '; insightsHTML += '
- ') insightsHTML += '
