diff --git a/models/cloudbrain_static.go b/models/cloudbrain_static.go index beb1ceee5..d5ef350ce 100644 --- a/models/cloudbrain_static.go +++ b/models/cloudbrain_static.go @@ -247,7 +247,7 @@ func getCreatePeriodCount(dateBeginTime string, dateEndTime string, hourBeginTim func getRunPeriodCount(dateBeginTime string, dateEndTime string, hourBeginTime string, hourEndTime string) (int64, error) { countSql := "SELECT count(*) FROM " + "public.cloudbrain where not ((to_char(to_timestamp(start_time), ' HH24:MI:SS') > '" + hourEndTime + - "') or (to_char(to_timestamp(end_time), 'HH24:MI:SS') < '" + hourBeginTime + "'))" + + "') or (to_char(to_timestamp(COALESCE(end_time,EXTRACT(epoch FROM now()))), 'HH24:MI:SS') < '" + hourBeginTime + "'))" + " and (to_char(to_timestamp(start_time), 'YYYY-MM-DD') >= '" + dateBeginTime + "' and to_char(to_timestamp(start_time), 'YYYY-MM-DD') < '" + dateEndTime + "')" return x.SQL(countSql).Count()