chore: add TODOs

This commit is contained in:
andig 2023-02-11 13:48:02 +01:00
parent 23f6cec1fb
commit 3763f5329f
2 changed files with 4 additions and 2 deletions

View file

@ -58,6 +58,7 @@ func (s *DB) Persist(session interface{}) {
}
// Return sessions
// TODO make this part of server/db
func (s *DB) Sessions() (Sessions, error) {
var res Sessions
tx := s.db.Find(&res)

View file

@ -60,8 +60,9 @@ func sessionHandler(w http.ResponseWriter, r *http.Request) {
}
}
whereQuery := "charged_kwh>=0.05 and strftime('%Y', created) like ? and strftime('%m', created) like ?"
if txn := dbserver.Instance.Where(whereQuery, fmtYear, fmtMonth).Order("created desc").Find(&res); txn.Error != nil {
// TODO support other databases than Sqlite
whereQuery := "charged_kwh>=0.05 AND strftime('%Y', created) LIKE ? AND strftime('%m', created) LIKE ?"
if txn := dbserver.Instance.Where(whereQuery, fmtYear, fmtMonth).Order("created DESC").Find(&res); txn.Error != nil {
jsonError(w, http.StatusInternalServerError, txn.Error)
return
}