Add db api function to get the latest run

This commit adds a new db api method to get the latest run added to
the db.

Change-Id: I0fb79a26fdd66aa029aab5b6fed5900cba9cd4cc
This commit is contained in:
Matthew Treinish 2014-08-29 16:41:30 -04:00
parent c036dba02b
commit d5602539a6

View File

@ -175,6 +175,13 @@ def get_all_test_runs():
return query.all()
def get_latest_run(session=None):
session = session or get_session()
query = db_utils.model_query(models.Run, session).order_by(
models.Run.run_at.desc())
return query.first()
def get_failing_from_run(run_id, session=None):
session = session or get_session()
query = db_utils.model_query(models.TestRun, session).filter_by(