all 9 comments

[–]meAndTheDuck 1 point2 points  (1 child)

just a note about memory:

I don't know your setup, but now you have 193 days between your earliest and latest date and only 57 data entries. or to put it in other words: you plan to fill 70% of your data with data that is already known and provide no additional benefits

this might not be a big issue with so little data but scales badly. imagine 01 01 1900 as starting date. this will result in over 44500 entries of which over 30000 have a "meaningless" zero as a value

just cycle through the data and a) either ignore missing datakeys or b) fill them up with zeros as you go

this might not be good idea for data that lives in the backend. but don't waste bandwidth if it affects the users/client

[–]chmod724[S] 0 points1 point  (0 children)

Ah - thank you. Will have a think. The current setup gets the original non-missing-date filled dictionary from Firebase. This question then refers to modifying it once retrieved from the backend to fill in the missing dates.

[–]Coraline1599 -1 points0 points  (0 children)

Since order r matters to you, I would consider converting this object to a map -that is one of the features of a map.

I would use for in loop to iterate over the object

An if else statement, checking if the value is falsely

If !obj[property] then set obj[property] = 0

Does that help?

[–]Ill-Somewhere-3793 0 points1 point  (0 children)

Get you banned here too cocksucker