Skip to content

Commit

Permalink
Fix where in stats
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Nov 6, 2024
1 parent db9073e commit 1584d16
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions IM/Stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,14 @@ def get_stats(init_date="1970-01-01", end_date=None, auth=None):
filt["date"] = {"$lte": datetime.datetime.strptime(end_date, "%Y-%m-%d").timestamp()}
res = db.find("inf_list", filt, {"id": True, "data": True, "date": True}, [('id', -1)])
else:
where = InfrastructureList._gen_where_from_auth(auth)
like = InfrastructureList._gen_where_from_auth(auth)
where = "where"
if like:
where += " (%s)" % like
if end_date:
where += " and date <= '%s'" % end_date
if like:
where += " and"
where += " date <= '%s'" % end_date
res = db.select("select data, date, id from inf_list %s order by rowid desc" % where)

for elem in res:
Expand Down

0 comments on commit 1584d16

Please sign in to comment.