Order food by date

This commit is contained in:
2024-08-09 19:55:31 +02:00
parent 715bc984be
commit db34fe039e
2 changed files with 2 additions and 2 deletions

View File

@@ -36,7 +36,7 @@ func (s *FoodService) GetRecent() ([]Food, error) {
return res, fmt.Errorf("cannot get recent food, db is nil or is not ready") return res, fmt.Errorf("cannot get recent food, db is nil or is not ready")
} }
row, err := s.db.readConn.Query(fmt.Sprintf("SELECT %s from foodView WHERE date > datetime('now', '-%d days')", foodColumns, Settings.FoodDaysLookback)) row, err := s.db.readConn.Query(fmt.Sprintf("SELECT %s from foodView WHERE date > datetime('now', '-%d days') order by date desc;", foodColumns, Settings.FoodDaysLookback))
if err != nil { if err != nil {
log.Printf("error getting daily food: %v", err) log.Printf("error getting daily food: %v", err)
return res, err return res, err

View File

@@ -1 +1 @@
21885a85602de6e2fc03dfdb5659741e 0539f67989f30cc4f97afd5c6035bcad