feat: enable to get calories from other months
This commit is contained in:
@@ -256,6 +256,10 @@ async function showMainApp() {
|
|||||||
updateCurrentDate();
|
updateCurrentDate();
|
||||||
|
|
||||||
// Get daily entries with total from Appwrite to display in calendar
|
// Get daily entries with total from Appwrite to display in calendar
|
||||||
|
fetchCaloriesCurrentMonth();
|
||||||
|
}
|
||||||
|
|
||||||
|
async function fetchCaloriesCurrentMonth() {
|
||||||
const entries = await AppwriteDB.getMonthlyCalories(selectedDate);
|
const entries = await AppwriteDB.getMonthlyCalories(selectedDate);
|
||||||
entries.forEach((entry) => {
|
entries.forEach((entry) => {
|
||||||
const calories = parseInt(entry.totalCalories);
|
const calories = parseInt(entry.totalCalories);
|
||||||
@@ -1203,6 +1207,7 @@ const selectDate = async (date: Date) => {
|
|||||||
selectedDate = date;
|
selectedDate = date;
|
||||||
updateCurrentDate();
|
updateCurrentDate();
|
||||||
await loadFoodEntries(date);
|
await loadFoodEntries(date);
|
||||||
|
await fetchCaloriesCurrentMonth();
|
||||||
renderCalendar();
|
renderCalendar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user