@@ -419,7 +419,7 @@ def db_get_recent_results2(cur: cursor, approved, limit, skip, max_age_days=None
419419 return [{col : val for col , val in zip (columns , row )} for row in cur .fetchall ()]
420420
421421
422- def db_get_report_history (cur : cursor , subject , scopeuuid ):
422+ def db_get_report_history (cur : cursor , subject , scopeuuid , limit = 500 ):
423423 """list all past reports for a subject/scope, newest first, with pass/fail/abort counts"""
424424 cur .execute ('''
425425 SELECT report.reportuuid, report.checked_at,
@@ -431,8 +431,9 @@ def db_get_report_history(cur: cursor, subject, scopeuuid):
431431 WHERE report.subject = %(subject)s
432432 AND result2.scopeuuid = %(scopeuuid)s
433433 GROUP BY report.reportuuid, report.checked_at
434- ORDER BY report.checked_at DESC;
435- ''' , {"subject" : subject , "scopeuuid" : scopeuuid })
434+ ORDER BY report.checked_at DESC
435+ LIMIT %(limit)s;
436+ ''' , {"subject" : subject , "scopeuuid" : scopeuuid , "limit" : limit })
436437 columns = ('reportuuid' , 'checked_at' , 'pass_count' , 'fail_count' , 'abort_count' )
437438 return [{col : val for col , val in zip (columns , row )} for row in cur .fetchall ()]
438439
0 commit comments