Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
add ability to sort on latest result while running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Dawson committed May 2, 2013
1 parent 8186f31 commit a5ba783
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion moztrap/view/runtests/views.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
""" """
import json import json
from django.db.models import Max


from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render from django.shortcuts import get_object_or_404, redirect, render
Expand Down Expand Up @@ -215,6 +216,12 @@ def run(request, run_id, env_id):
envform = EnvironmentSelectionForm( envform = EnvironmentSelectionForm(
current=environment.id, environments=run.environments.all()) current=environment.id, environments=run.environments.all())


current_result_select = (
"SELECT status from execution_result as r "
"WHERE r.runcaseversion_id = execution_runcaseversion.id "
"AND r.status in ('passed', 'invalidated', 'failed') "
"AND r.is_latest = 1 "
"ORDER BY r.created_on DESC LIMIT 1")


return TemplateResponse( return TemplateResponse(
request, request,
Expand All @@ -229,7 +236,10 @@ def run(request, run_id, env_id):
"caseversion").prefetch_related( "caseversion").prefetch_related(
"caseversion__tags", "caseversion__tags",
"caseversion__case__suites", "caseversion__case__suites",
).filter(environments=environment), ).filter(
environments=environment,
).extra(select={
"current_result": current_result_select}),
"finder": { "finder": {
# finder decorator populates top column (products), we # finder decorator populates top column (products), we
# prepopulate the other two columns # prepopulate the other two columns
Expand Down
2 changes: 1 addition & 1 deletion templates/runtests/list/_run_listordering.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


{% block sortitems %} {% block sortitems %}
<li class="sortitem bybulk-open"><a href="#" title="show all details">bulk open</a></li> <li class="sortitem bybulk-open"><a href="#" title="show all details">bulk open</a></li>
{% include "lists/_sortitem.html" with sortname="results" %} {% include "lists/_sortitem.html" with sortname="results" sortID="current_result" %}
{% include "lists/_sortitem.html" with sortname="name" sortID="caseversion__name" %} {% include "lists/_sortitem.html" with sortname="name" sortID="caseversion__name" %}
{% include "lists/_sortitem.html" with sortname="suites" %} {% include "lists/_sortitem.html" with sortname="suites" %}
{% include "lists/_sortitem.html" with sortname="order" sortID="order" %} {% include "lists/_sortitem.html" with sortname="order" sortID="order" %}
Expand Down

0 comments on commit a5ba783

Please sign in to comment.