feat: enable to get calories from other months

This commit is contained in:
2025-11-03 11:25:39 -03:00
parent 96af3c87c4
commit f0de21dbde
+5
View File
@@ -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();
} }