-
Notifications
You must be signed in to change notification settings - Fork 16
Description
I have an element which uses custom element with iron-range-behaviour inside a complicated nested dom-repeat arrangement. The dom-repeats are used to draw a large calendar - with slots for filling in each day with data. The data is retrieved using ajax later, and the paths to this data updated when the data is received. The day data is essentially information that can be calculated statically (the date, the day names, and the data to be fetched is the number of slots available and the number of slots filled. I have initialise these slots to something before it is fetched - the convenient value is 0.
I am then doing the following:-
slot=0;
for(week = 0; week < this.weeks.length; week++) {
for(day = 0; day < this.weeks[week].length; day++) {
path = 'weeks.' + week + '.' + day
if(slot < response.slots.length
&& this.weeks[week][day].date == response.slots[slot][0] ) {
//we have an entry
s = response.slots[slot];
this.set(path + '.appts', s[1]);
this.set(path + '.slots', s[2]);
...
I couldn't figure out why, despite knowing the responses being fired back, had values for appts, they were all showing as 0.
It turns out that in order to ensure the ratio that iron-range-behaviour calculates is between 0 and 100% that the value is clamped between the min and max values.. There is no word about this clamping in the iron-range-documentation.
What was happening in my case is that I set the value before the max, so the value got clamped to 0 (as max was zero) and then max gets set to its amount.
Why does the clamped value need to be written back to the property. Cannot it just be used in the calculations.