diff --git a/frontend/src/pages/History.jsx b/frontend/src/pages/History.jsx index cd6f36a..9e96686 100644 --- a/frontend/src/pages/History.jsx +++ b/frontend/src/pages/History.jsx @@ -589,23 +589,13 @@ function NutritionSection({ nutrition, weights, profile, insights, onRequest, lo // ── Activity Section ────────────────────────────────────────────────────────── function ActivitySection({ activities, insights, onRequest, loadingSlug, filterActiveSlugs, globalQualityLevel }) { const [period, setPeriod] = useState(30) - // Issue #31: Use global quality filter from profile as default - const [qualityLevel, setQualityLevel] = useState(globalQualityLevel || 'all') if (!activities?.length) return ( ) const cutoff = dayjs().subtract(period,'day').format('YYYY-MM-DD') - // Issue #24: Mehrstufiger Quality-Filter - const filtA = activities.filter(d => { - if (period !== 9999 && d.date < cutoff) return false - - if (qualityLevel === 'all') return true - if (qualityLevel === 'quality') return ['excellent', 'good', 'acceptable'].includes(d.quality_label) - if (qualityLevel === 'very_good') return ['excellent', 'good'].includes(d.quality_label) - if (qualityLevel === 'excellent') return d.quality_label === 'excellent' - return true - }) + // Issue #31: Backend already filters by global quality level - only filter by period here + const filtA = activities.filter(d => period === 9999 || d.date >= cutoff) const byDate={} filtA.forEach(a=>{ byDate[a.date]=(byDate[a.date]||0)+(a.kcal_active||0) }) @@ -634,36 +624,26 @@ function ActivitySection({ activities, insights, onRequest, loadingSlug, filterA - {/* Issue #24: Mehrstufiger Quality-Filter */} -
-
QUALITÄTSFILTER
-
- {[ - {v:'all', l:'Alle', icon:'📊'}, - {v:'quality', l:'Hochwertig', icon:'✓'}, - {v:'very_good', l:'Sehr gut', icon:'✓✓'}, - {v:'excellent', l:'Exzellent', icon:'⭐'} - ].map(o => ( - - ))} + {/* Issue #31: Show active global quality filter */} + {globalQualityLevel && globalQualityLevel !== 'all' && ( +
+ + {globalQualityLevel === 'quality' && '✓ Filter: Hochwertig (excellent, good, acceptable)'} + {globalQualityLevel === 'very_good' && '✓✓ Filter: Sehr gut (excellent, good)'} + {globalQualityLevel === 'excellent' && '⭐ Filter: Exzellent (nur excellent)'} + + + Hier ändern → +
- {qualityLevel !== 'all' && ( -
- {filtA.length} von {activities.filter(d=>period===9999||d.date>=cutoff).length} Aktivitäten - {qualityLevel === 'quality' && ' (excellent, good, acceptable)'} - {qualityLevel === 'very_good' && ' (excellent, good)'} - {qualityLevel === 'excellent' && ' (nur excellent)'} -
- )} -
+ )}
{[['Trainings',filtA.length,'var(--text1)'],['Kcal',totalKcal,'#EF9F27'],