chore: add TODOs
This commit is contained in:
parent
23f6cec1fb
commit
3763f5329f
2 changed files with 4 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue