pull down to refresh

Yes, it's not rolling but it checks every midnight Chicago time if the streak is still valid. This means you can gain a streak at any time but you can only lose it at midnight.
And anon gets an extra day?
No, this function is used in two different contexts. In the first context, it's called to check if a user has a new streak. We pass userId in that case and then we check for their zaps from today.
In the other context, it's called without userId to check if streaks have been lost. This means we want to get zaps from all users from the previous day since remember, we run this function at midnight which basically means slightly after midnight. Therefore, we need - interval '1 day' in that case.
Could have been communicated better through the code but it works.
Thank you for the explanation!
reply
28 sats \ 0 replies \ @ek 17 Oct
No worries, glad people are interested in the code
reply