fix: count only zaps after goal creation towards goal

This commit is contained in:
Alejandro Gomez 2023-07-06 21:29:30 +02:00
parent 5fdccba220
commit 85db515124
No known key found for this signature in database
GPG Key ID: 4DF39E566658C817

View File

@ -78,6 +78,12 @@ export function LiveChat({
const zaps = feed.zaps
.map((ev) => parseZap(ev, System.ProfileLoader.Cache))
.filter((z) => z && z.valid);
const goalZaps = feed.zaps
.filter((ev) => (goal ? ev.created_at > goal.created_at : false))
.map((ev) => parseZap(ev, System.ProfileLoader.Cache))
.filter((z) => z && z.valid);
const events = useMemo(() => {
return [...feed.messages, ...feed.zaps].sort(
(a, b) => b.created_at - a.created_at
@ -118,7 +124,7 @@ export function LiveChat({
<TopZappers zaps={zaps} />
</div>
{goal ? (
<Goal link={link} ev={goal} zaps={zaps} />
<Goal link={link} ev={goal} zaps={goalZaps} />
) : (
login?.pubkey === streamer && <NewGoalDialog link={link} />
)}