Skip to content

Commit

Permalink
Allow load all time range data
Browse files Browse the repository at this point in the history
  • Loading branch information
dhamith93 committed Sep 27, 2021
1 parent 4f2990a commit 0cbbbd3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions internal/database/local_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ func GetLogFromDB(database *sql.DB, logType string, from int64, to int64, time i

func getLogFromDBInRange(database *sql.DB, logType string, from int64, to int64) []string {
query := "SELECT log_text FROM monitor_log WHERE log_type = ?"
diff := to - from
// diff := to - from

if diff > 21600 && diff <= 172800 {
query = query + " AND STRFTIME('%M', DATETIME(save_time, 'unixepoch')) IN ('01', '30')"
}
// if diff > 21600 && diff <= 172800 {
// query = query + " AND STRFTIME('%M', DATETIME(save_time, 'unixepoch')) IN ('01', '30')"
// }

if diff > 172800 {
query = query + " AND STRFTIME('%H%M', DATETIME(save_time, 'unixepoch')) IN ('0001', '0601', '1201', '1801')"
}
// if diff > 172800 {
// query = query + " AND STRFTIME('%H%M', DATETIME(save_time, 'unixepoch')) IN ('0001', '0601', '1201', '1801')"
// }

query = query + " AND save_time BETWEEN ? AND ? ORDER BY save_time"

Expand Down

0 comments on commit 0cbbbd3

Please sign in to comment.