feat: add prayer frequency tracking with 1-7 slider and frequency compliance calculation

This commit is contained in:
nmemmert committed 2026-01-16 08:40:09 -05:00
1 parent 4225ef017c
commit 8105d39554
7 files changed
+88 -8

No files matched your search

+18
View File
@@ -11,6 +11,8 @@ interface Prayer {
prayFor?: string;
answered?: boolean;
answerDetails?: string;
prayFrequency?: number; // 1-7 times per week
lastPrayedFor?: string; // ISO date string
}
interface HomePageProps {
@@ -52,7 +54,23 @@ export default function HomePage({ prayers, todayCount, onStartPraying, onSelect
return streak;
};
// Calculate frequency compliance - how many active items being prayed for
const frequencyCompliance = () => {
const activePrayers = prayers.filter(p => !p.answered && p.prayFrequency);
if (activePrayers.length === 0) return 0;
// Check today's date
const todayPrayers = prayers.filter(p => p.date === today);
return {
total: activePrayers.length,
prayedToday: activePrayers.filter(ap =>
todayPrayers.some(tp => tp.prayFor === ap.prayFor || tp.id === ap.id)
).length,
};
};
const streak = calculateStreak();
const frequencyStats = frequencyCompliance();
// Calculate more stats
const avgPrayerLength = totalPrayers > 0