For each user I have a list of Stats. Each has a timestamp and a number of ounces. E.g., User A has a list of Stats:
7/2/2024 00:00, 12.5oz
6/30/2024 00:00, 4 oz
6/26/2024 00:00, 13oz
I want to generate a list on the page that will be the datasource for a barchart of their stats over the last 7 days. So for User A, the list would be
(13, 0, 0, 0, 4, 0, 12.5) because today is 7/2/2024.
How do I generate that list efficiently on the page? I want to avoid creating lots of placeholder Stats with 0s because they’re bloating my app.