Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Current Streak update so specific times aren't missed #13558

Conversation

donofriov
Copy link
Contributor

Pre-Submission Checklist

  • Your pull request targets the staging branch of freeCodeCamp.
  • Branch starts with either fix/, feature/, or translate/ (e.g. fix/signin-issue)
  • You have only one commit (if not, squash them into one commit).
  • All new and existing tests pass the command npm test. Use git commit --amend to amend any fixes.

Type of Change

  • Breaking change (fix or feature that would change existing functionality)

Checklist:

Description

I made a few updates to how the current streak works to cover all cases close to the "next day" where a streak wasn't continuing even though it should have.

@BerkeleyTrue BerkeleyTrue added the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Feb 23, 2017
@@ -2,7 +2,7 @@ import _ from 'lodash';
import moment from 'moment-timezone';
import { dayCount } from '../utils/date-utils';

const daysBetween = 1.5;
const daysBetween = 2;

This comment was marked as off-topic.

@@ -16,7 +16,7 @@ export function prepUniqueDays(cals, tz = 'UTC') {
export function calcCurrentStreak(cals, tz = 'UTC') {

let prev = _.last(cals);
if (moment().tz(tz).startOf('day').diff(prev, 'days') > daysBetween) {
if (moment().tz(tz).diff(prev, 'days') > daysBetween) {

This comment was marked as off-topic.

4,
'should return 4 when there is a break in UTC (but no break in PST)'
16,
'should return 16 when there is a break in UTC (but no break in PST)'

This comment was marked as off-topic.

@donofriov
Copy link
Contributor Author

donofriov commented Feb 23, 2017

@raisedadead will probably want a lot of eyes on this because it affects a very visible feature. Also it was tough to test locally because I couldn't force change my local time to see if streaks were continuing...

@raisedadead
Copy link
Member

@donofriov thanks a lot for this pull request, and apologies for the delay in getting back. I have been away for a while now.

@BerkeleyTrue the code looks fine to me, but there is no real way to confirm without sending this change out to the wild, if you think this is okay, we should test this on beta and keep under observation?

/cc @QuincyLarson I would seek your advice on this as well.

@QuincyLarson
Copy link
Contributor

@raisedadead I think one way we can make sure we didn't accidentally make it less inclusive is to ship this and see what happens to a profile like @revisualize's: https://www.freecodecamp.com/revisualize

As long as his streak is still intact, we'll know it's at least as inclusive as before (and we want to err on the side of inclusivity and streak generosity).

@donofriov
Copy link
Contributor Author

Please don't merge this as is, I just found a bug with longest streak. I'm able to force some data locally, will submit an update today.

@raisedadead raisedadead added the status: blocked Is waiting on followup from either the Opening Poster of the issue or PR, or a maintainer. label Mar 27, 2017
@BerkeleyTrue BerkeleyTrue removed the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Mar 27, 2017
@BerkeleyTrue
Copy link
Contributor

@donofriov Any updates on this?

@raisedadead
Copy link
Member

Hi @donofriov I am closing this, please re-open when you are ready. Thanks a lot for the hard work.

@raisedadead raisedadead removed the status: blocked Is waiting on followup from either the Opening Poster of the issue or PR, or a maintainer. label May 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants