Skip to content

Adding a feature : Increase color intensity based on streak#478

Merged
lazyguru merged 3 commits intopyrochlore:masterfrom
Lokesh-Bharath:fix-issue-395
Jun 19, 2025
Merged

Adding a feature : Increase color intensity based on streak#478
lazyguru merged 3 commits intopyrochlore:masterfrom
Lokesh-Bharath:fix-issue-395

Conversation

@Lokesh-Bharath
Copy link
Copy Markdown
Contributor

@Lokesh-Bharath Lokesh-Bharath commented Jun 12, 2025

Description

Adding an option to have the calendar increase the color of the streak circle with increase in streak. This motivates the user to aim and retain a higher streak. The intensity starts low and increases till a 28 days streak. It maxes out at 28 days and thereon shows the same color even with increase in streak.
This option can be enabled or disabled using 'circleColorByStreak' field based on preference.

Fixes # (issue)

#395

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • If this is a new feature, did you add files to the examples directory to demonstrate the feature?
  • If this is a new feature, did you add documentation to the docs directory for the feature?

@Lokesh-Bharath Lokesh-Bharath changed the title Fix issue 395 Adding a feature : Increase color intensity based on streak Jun 12, 2025
@Lokesh-Bharath
Copy link
Copy Markdown
Contributor Author

Hey @lazyguru, I almost forgot about raising this PR from 2 moths back. The changes are tested, Please feel free to review it and revert back at your convenience

Copy link
Copy Markdown
Collaborator

@lazyguru lazyguru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only a minor nit-pick. Thanks again for your contributions!

} else {
break;
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit-pick: My preference would be to follow the Return Early pattern. Something like this (while longer) is easier to follow mentally:

   while(curStreakCount < 28) {
        let curValue = dataset.getValue(streakStartDate);
        if (curValue == null || curValue == threshold) break;
        if (thresholdType === ThresholdType.GreaterThan && curValue < threshold) break;
        if (thresholdType === ThresholdType.LessThan && curValue > threshold) break;
        curStreakCount++;
        streakStartDate = streakStartDate.subtract(1, "days");
    }

@lazyguru lazyguru merged commit 3562eae into pyrochlore:master Jun 19, 2025
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.

2 participants