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

Commit

Permalink
loading page shows when others have executed a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Dawson committed Nov 2, 2012
1 parent 59ad142 commit bd3e9a9
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
41 changes: 41 additions & 0 deletions moztrap/view/runtests/templatetags/execution.py
Expand Up @@ -58,6 +58,47 @@ def render_tag(self, context, runcaseversion, user, environment, varname):



class AlreadyTested(Tag):
"""
Places whether other user has a result for this runcaseversion/env in context.
If no relevant Result exists, returns false
"""
name = "already_tested"
options = Options(
Argument("runcaseversion"),
Argument("user"),
Argument("environment"),
"as",
Argument("varname", resolve=False),
)


def render_tag(self, context, runcaseversion, user, environment, varname):
"""Get/construct Result and place it in context under ``varname``"""
include_kwargs = dict(
environment=environment,
runcaseversion=runcaseversion,
is_latest=True,
)
exclude_kwargs = dict(
tester=user,
)
try:
result = model.Result.objects.filter(
**include_kwargs).exclude(**exclude_kwargs).order_by(
"-modified_on")[0]
context[varname] = result
except IndexError:
context[varname] = None
return u""


register.tag(AlreadyTested)



class StepResultFor(Tag):
"""
Places StepResult for this result/casestep in context.
Expand Down
13 changes: 11 additions & 2 deletions templates/runtests/list/_runtest_list_item.html
Expand Up @@ -2,14 +2,23 @@

{% with runcaseversion.caseversion as caseversion %}
{% result_for runcaseversion user environment as result %}
{% already_tested runcaseversion user environment as already_tested %}

<article id="test-id-{{ runcaseversion.id }}" class="listitem {{ result.status }}" data-title="{{ caseversion.name }}">

<div class="itemhead">
<div class="results">
<span class="result {{ result.status }}">
{% if already_tested and result.status == result.STATUS.assigned or already_tested and result.status == result.STATUS.started %}
<span class="result {{ already_tested }}" title="{{ already_tested.status }} by {{already_tested.modified_by}}">
{% else %}
<span class="result {{ result.status }}">
{% endif %}
{% if result.status == result.STATUS.assigned or result.status == result.STATUS.started %}
pending
{% if already_tested %}
already tested
{% else %}
pending
{% endif %}
{% else %}
{{ result.status }}
{% endif %}
Expand Down

0 comments on commit bd3e9a9

Please sign in to comment.