Skip to content

Commit b01bd60

Browse files
committed
Fix where in stats
1 parent 18eba82 commit b01bd60

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

IM/Stats.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,14 @@ def get_stats(init_date="1970-01-01", end_date=None, auth=None):
117117
filt["date"] = {"$lte": datetime.datetime.strptime(end_date, "%Y-%m-%d").timestamp()}
118118
res = db.find("inf_list", filt, {"id": True, "data": True, "date": True}, [('id', -1)])
119119
else:
120-
where = InfrastructureList._gen_where_from_auth(auth)
120+
like = InfrastructureList._gen_where_from_auth(auth)
121+
where = "where"
122+
if like:
123+
where += " (%s)" % like
121124
if end_date:
122-
where += " and date <= '%s'" % end_date
125+
if like:
126+
where += " and"
127+
where += " date <= '%s'" % end_date
123128
res = db.select("select data, date, id from inf_list %s order by rowid desc" % where)
124129

125130
for elem in res:

0 commit comments

Comments
 (0)