The plugin should give priority to manually-set scale when mapping intensity #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
So, I struggled for an hour to understand why this plugin failed to map my "mindfulness:: 10" entries with the correct shade of color. Then I discovered that it happened that, by coincidence, I meditated 10 minutes for the first 3 days of the year. In this case, the plugin check
minimumIntensity === maximumIntensity
(the actual minimum and maximum values of my entries), and because they are the same, it completely ignores my scale (that goes from 1 to 60) and try to set the intensity index 10 (that doesn't exist).I find this behavior confusing, especially at the beginning of the year (when there are just a couple of entries and, therefore, it is very likely that
minimumIntensity === maximumIntensity
by accident).A better behavior should be to always map the intensity between
intensityScaleStart
andintensityScaleEnd
if the user set those values. If not, they will fall back tominimumIntensity === maximumIntensity
and, therefore, the old behavior is preserved. So I think we can have our cake and eat it.This PR address this.