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 and intensityScaleEnd if the user set those values. If not, they will fall back to minimumIntensity === maximumIntensity and, therefore, the old behavior is preserved. So I think we can have our cake and eat it.
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.