Revisit the structure of time windows #310
Description
This touched upon a little in issue #300
Currently, the time windows are structured as an array of arrays. The larger array has 5 elements pertaining to the following: month, day, hour, minute, second. Within each smaller array, each element stands for each window in that dimension. Where the first element is the current window of time
, and every subsequent element is current window of time - index
Suffice to say, this can be a little confusing and could be using more space than necessary. For the outer array, it could potentially just be an object with each property pertaining to a dimension. For instances
{
"M": {},
"D": {},
"h": {},
"m": {},
"s": {}
}
This may make it easier to understand the structure and allow removal of things like:
// Time dimension keys corresponding to their respective window positions
const dimensions = ['s', 'm', 'h', 'D', 'M'];
@rajkiranrbala also proposed a way of handling each individual window within each dimension in the above issue in a way that there would no longer be any unnecessary empty windows. Essentially, within a dimension, the properties would be a number pertaining to the number behind the current window.
For example
{
"D" : {
"0": { "quantity": 200 },
"4": { "quantity": 300 }
}
}
This would prevent unnecessary creation of days - (1 to 3) when they have no usage in the first place.
Thoughts?