monkeytype icon indicating copy to clipboard operation
monkeytype copied to clipboard

Implement streaks

Open typermonkeyuser opened this issue 3 years ago • 14 comments

Hi,

I've added the concept of streaks. I updated the profile page to show the user's current streak. image

The streak will also affect the XP bonus, the larger the streak, the higher bonus.

I have updated the XP modifier to add the log10 calculation of the streak. That means that a streak below 10 days will increase the modifier with 0.x, a streak below 100 will increase the modifier with 1.x, a streak below 1000 will increase the modifier with 2.x etc.

typermonkeyuser avatar Aug 07 '22 13:08 typermonkeyuser

I think the implementation could be better. Installing that package and calculating the streak on both the frontend and backend seems a bit wasteful.

Instead I propose a new user endpoint on the backend that just gets the streak of the user.

Ferotiq avatar Aug 07 '22 18:08 Ferotiq

@Ferotiq I now store the streak on the user. The expensive calculation is only necessary once, after that the streak is calculated based on the last result.

typermonkeyuser avatar Aug 08 '22 06:08 typermonkeyuser

@Ferotiq Would you like to take an additional look, after my latest changes?

typermonkeyuser avatar Aug 08 '22 09:08 typermonkeyuser

I think it's fine to just avoid the init calculation and ignore any streaks before this feature is introduced

Miodec avatar Aug 08 '22 14:08 Miodec

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2818005686

github-actions[bot] avatar Aug 08 '22 14:08 github-actions[bot]

@Miodec Thanks, I have removed the code performing the initial calculation.

typermonkeyuser avatar Aug 08 '22 14:08 typermonkeyuser

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2818658674

github-actions[bot] avatar Aug 08 '22 14:08 github-actions[bot]

@Miodec The tests should also be passing now :) I was unfortunate to hit the code coverage threshold with 39.73% code coverage 😂

typermonkeyuser avatar Aug 08 '22 15:08 typermonkeyuser

@Miodec Would you like to re-activate the tests?

typermonkeyuser avatar Aug 08 '22 17:08 typermonkeyuser

@Miodec @Ferotiq Will one of you take an additional look when you have time? :)

typermonkeyuser avatar Aug 10 '22 06:08 typermonkeyuser

Why close?

Miodec avatar Aug 10 '22 11:08 Miodec

Mistake

typermonkeyuser avatar Aug 10 '22 11:08 typermonkeyuser

I don't like how you're getting the whole user doc everytime the profile is viewed. Plus it looks like if you view someone else's profile, their streak data will be put into the local db snapshot.

You should get the streak data from the profile endpoint. As for updating local db snapshot - add the streak data to the result adding response.

Also, isToday and isYesterday should probably be placed in misc.ts

Miodec avatar Aug 12 '22 13:08 Miodec

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2832202634

github-actions[bot] avatar Aug 12 '22 13:08 github-actions[bot]

This PR is stale. Please trigger a re-run of the PR check action.

github-actions[bot] avatar Aug 20 '22 20:08 github-actions[bot]

Waiting for you to address the issues raised by me and Bruce

Miodec avatar Aug 22 '22 11:08 Miodec

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2909824689

github-actions[bot] avatar Aug 23 '22 08:08 github-actions[bot]

@typermonkeyuser any updates?

rizwanmustafa avatar Aug 30 '22 17:08 rizwanmustafa

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2989112343

github-actions[bot] avatar Sep 04 '22 18:09 github-actions[bot]

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2989121485

github-actions[bot] avatar Sep 04 '22 18:09 github-actions[bot]

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2989197900

github-actions[bot] avatar Sep 04 '22 19:09 github-actions[bot]

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2989199062

github-actions[bot] avatar Sep 04 '22 19:09 github-actions[bot]

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2989225400

github-actions[bot] avatar Sep 04 '22 19:09 github-actions[bot]

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2989363964

github-actions[bot] avatar Sep 04 '22 19:09 github-actions[bot]

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2989407426

github-actions[bot] avatar Sep 04 '22 20:09 github-actions[bot]

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2989441804

github-actions[bot] avatar Sep 04 '22 20:09 github-actions[bot]

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2989477713

github-actions[bot] avatar Sep 04 '22 20:09 github-actions[bot]

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2989485109

github-actions[bot] avatar Sep 04 '22 20:09 github-actions[bot]

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2989532102

github-actions[bot] avatar Sep 04 '22 21:09 github-actions[bot]

The PR check action failed. Please review the logs and make the necessary changes. https://github.com/monkeytypegame/monkeytype/actions/runs/2989566082

github-actions[bot] avatar Sep 04 '22 21:09 github-actions[bot]