Study-Together-Org / time_counter

12 stars 5 forks source link

How does streak system work on V2? #47

Closed Arianthell closed 3 years ago

Arianthell commented 3 years ago

Could you explain how V2's streak system works? For V1 your streak gets counted at certain hour (around 1am GMT+1 i think?) and if you havent studied for 1h between 2 streak timepoints, you lose your streak. So I understand that for V2, your streak gets counted right after you do 1h. But how does it work? Cuz I noticed that sometimes it counts 2 streaks for me if I studied both before and after midnight too? And when/how does the streak gets reset if I dont study?

Zackhardtoname commented 3 years ago

It's a fixed timepoint - UTC 5 pm

Arianthell commented 3 years ago

Ooooh that's why I get +1 streak at night since it's 2 am for me. So you get +1 streak right after doing 1h, but if you don't do any hours between two 5pm UTC you lose it, correct?

Zackhardtoname commented 3 years ago

Actually, I would call it "fixed" rather than "fluid" (my bad as I used that term before) since there's a fixed time point. It's based on this https://github.com/Zackhardtoname/study_together/blob/0e682e3fbd35bcc51e06b4264fbbae6f98127b61/config.hjson#L97-L102

Zackhardtoname commented 3 years ago

So you get +1 streak right after doing 1h, but if you don't do any hours between two 5pm UTC you lose it, correct?

exactly; I would say I should not say there's a grace period neither. It's just that the max gap of studying to still keep the streak is 48 - 1 - 1 = 46 hours by studying in the first hour of day 1 and last hour of day 2. So a user could have a non-study day in their timezone, but in the settings here (UTC 5 PM), it'd be a user has to study every day.

Zackhardtoname commented 3 years ago

Reopen if you have more questions on this

Zackhardtoname commented 3 years ago

Note the bot only starts resetting current_streak to 0 after it has been alive for 24 hours. So upon restarting the bots, there would be some period like a day when people can keep their streak without studying... It helps for times when we delete or change v2 logs or stop running v2 for a day or so. Hence #38 could be useful

https://github.com/Zackhardtoname/study_together/blob/43a82c4061f458a39c8884d7f7a8e3b9c927bf51/time_counter.py#L227-L228