fix: calculate Most Prayed For based on Mark Prayed clicks, not prayer count
This commit is contained in:
1 parent
8b4109a8fd
commit
649daa3dda
1 file changed
+2
-2
@@ -100,10 +100,10 @@ export default function HomePage({ prayers, todayCount, onStartPraying, onSelect
|
|||||||
? Math.round((answeredPrayers / totalPrayers) * 100)
|
? Math.round((answeredPrayers / totalPrayers) * 100)
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
// Get most prayed for person/topic
|
// Get most prayed for person/topic based on lastPrayedFor clicks
|
||||||
const prayerForCounts: Record<string, number> = {};
|
const prayerForCounts: Record<string, number> = {};
|
||||||
prayers.forEach(p => {
|
prayers.forEach(p => {
|
||||||
if (p.prayFor) {
|
if (p.prayFor && p.lastPrayedFor) {
|
||||||
prayerForCounts[p.prayFor] = (prayerForCounts[p.prayFor] || 0) + 1;
|
prayerForCounts[p.prayFor] = (prayerForCounts[p.prayFor] || 0) + 1;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in new issue
Block a user