MySQL and Postgres complain about the group by, so calculate dates ourselves

This commit is contained in:
Joseph Schorr 2015-08-06 12:52:55 -04:00
parent 5c213df835
commit ea25538646
2 changed files with 12 additions and 4 deletions

View file

@ -35,7 +35,7 @@ def get_log_entry_kinds():
def get_aggregated_logs(start_time, end_time, performer=None, repository=None, namespace=None):
date = db.extract_date('day', LogEntry.datetime)
selections = [LogEntry.kind, LogEntry.datetime, fn.Count(LogEntry.id).alias('count')]
selections = [LogEntry.kind, date.alias('day'), fn.Count(LogEntry.id).alias('count')]
query = _logs_query(selections, start_time, end_time, performer, repository, namespace)
return query.group_by(date, LogEntry.kind)