Skip to content

Commit

Permalink
fixed the dishNameDownloader-chronjob not handling some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Mar 17, 2024
1 parent 88045b6 commit 1fc4a52
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server/backend/cron/dish_name_download.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func downloadDailyDishes(c *CronService) {
var results []model.Cafeteria
if err := c.db.Find(&results).Error; err != nil {
log.WithError(err).Error("Error while querying all cafeteria names from the database.")
return
}

year, week := time.Now().UTC().ISOWeek()
Expand All @@ -63,6 +64,7 @@ func downloadDailyDishes(c *CronService) {
Where("year = ? AND week = ?", year, week).
Count(&weekliesWereAdded).Error; err != nil {
log.WithError(err).Error("Error while checking whether the meals of the current week have already been added to the weekly table.")
return
}

for _, v := range results {
Expand All @@ -86,6 +88,7 @@ func downloadDailyDishes(c *CronService) {
var dishes CanteenDays
if err := json.NewDecoder(resp.Body).Decode(&dishes); err != nil {
log.WithError(err).Error("Error in Parsing")
return
}

for weekDayIndex, day := range dishes.Days {
Expand Down

0 comments on commit 1fc4a52

Please sign in to comment.