Retrieving daily calories from Logs and displaying in Progress Tab
- Dominic Ng
- Dec 30, 2018
- 2 min read
Hey! It is the end of the two weeks break everyone is looking for after a tiring first term. However, after the term break ends, there will be many assignments piling together, especially taking MAD and DSA, the assignments due date of my electives as well as UX, Korean as well as CPP are all in the same week. Hence, time left for the development for Gastronome will significantly decrease when the term break ends. This week I took on the task of retrieving the daily calories of the user from their weekly log and display it in the Progress page so users would be able to track their daily calories intake to see whether the calorie intake is normal or they are unconsciously eating unhealthily.
At the start of the designing of the data structure of Firebase, the calories attribute was not stored in the weekly log node. Hence, at first, when I was developing the progress page, after pulling data of what the user has eaten based on the date, I had to retrieve data from the Recipe node to retrieve the calories of each meal. This was rather inefficient as I had to pull data from Firebase twice just to retrieve the daily calorie intake of the user on a specific day. I then added the calorie attribute into the log node so that in this page, I can simply retrieve the calories of each meal and add them to the dally calorie intake and display them. With the new attribute, the application only has to pull data from Firebase once in order to display the daily calorie intake of the user.
After completing the task where the application has to retrieve the daily calorie of each day and display them in the Progress tab, I will start working on the main and unique feature of the application, estimating the user’s weight based on the user’s details as well as the meals in their weekly logs. I will be documenting my progress in my blog next week! See you!


Comments