Skip to content

Commit

Permalink
Show result text in job list (#3506)
Browse files Browse the repository at this point in the history
Closes: #3495
  • Loading branch information
chrisvanrun authored Aug 19, 2024
1 parent 2f96bbe commit 281984b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
{{ object.comment }}
<split></split>

<div class="child-p-mb-0 text-left">
{{ object.rendered_result_text }}
</div>

<split></split>
<ul class="list-unstyled mb-0 text-left">
{% if object.error_message %}

Expand Down
4 changes: 4 additions & 0 deletions app/grandchallenge/algorithms/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,10 @@ class JobsList(PaginatedTableListView):
sort_field="comment",
optional_condition=lambda obj: bool(obj.comment),
),
Column(
title="Result",
optional_condition=lambda obj: bool(obj.rendered_result_text),
),
Column(title="Results"),
Column(title="Viewer"),
]
Expand Down
4 changes: 4 additions & 0 deletions app/grandchallenge/core/static/css/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ p {
line-height: 1.6;
}

.child-p-mb-0 > p {
margin-bottom: 0;
}

.jumbotron {
text-shadow: 0.1rem 0.1rem 0.2rem #000000;
}
Expand Down
29 changes: 0 additions & 29 deletions app/tests/algorithms_tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import pytest
from django.contrib.auth.models import Group
from django.contrib.humanize.templatetags.humanize import naturaltime
from django.core.files.base import ContentFile
from django.utils import timezone
from django.utils.text import slugify
Expand All @@ -20,9 +19,6 @@
InterfaceKind,
)
from grandchallenge.subdomains.utils import reverse
from grandchallenge.workstations.templatetags.workstations import (
workstation_session_control_data,
)
from tests.algorithms_tests.factories import (
AlgorithmFactory,
AlgorithmImageFactory,
Expand Down Expand Up @@ -1413,13 +1409,6 @@ def test_job_list_row_template_ajax_renders(client):
time_limit=algorithm.time_limit,
)

ctrl_data = workstation_session_control_data(
workstation=algorithm.workstation,
context_object=algorithm,
algorithm_job=job,
config=algorithm.workstation_config,
)

headers = {"HTTP_X_REQUESTED_WITH": "XMLHttpRequest"}

response = get_view_for_user(
Expand All @@ -1444,28 +1433,10 @@ def test_job_list_row_template_ajax_renders(client):
"algorithms:job-detail",
kwargs={"slug": job.algorithm_image.algorithm.slug, "pk": job.pk},
)
job_created = str(naturaltime(job.created))

response_content = json.loads(response.content.decode("utf-8"))

assert response.status_code == 200

assert response_content["recordsTotal"] == 1

assert len(response_content["data"]) == 1

assert job_details_url in response_content["data"][0][0]

assert job_created in response_content["data"][0][1]

assert editor.username in response_content["data"][0][2]

assert job.get_status_display() in response_content["data"][0][3]

assert "Result and images are private" in response_content["data"][0][4]

assert job.comment in response_content["data"][0][5]

assert "Empty" in response_content["data"][0][6]

assert ctrl_data in response_content["data"][0][7]
33 changes: 1 addition & 32 deletions app/tests/archives_tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from pathlib import Path

import pytest
from django.contrib.humanize.templatetags.humanize import naturaltime
from guardian.shortcuts import assign_perm, remove_perm
from requests import put

Expand All @@ -15,9 +14,6 @@
from grandchallenge.cases.widgets import WidgetChoices
from grandchallenge.components.models import ComponentInterface, InterfaceKind
from grandchallenge.subdomains.utils import reverse
from grandchallenge.workstations.templatetags.workstations import (
workstation_session_control_data,
)
from tests.algorithms_tests.factories import AlgorithmJobFactory, Job
from tests.archives_tests.factories import (
ArchiveFactory,
Expand Down Expand Up @@ -1352,7 +1348,7 @@ def make_request():


@pytest.mark.django_db
def test_job_list_row_template_ajax_renders(client):
def test_item_job_list_row_template_ajax_renders(client):
archive = ArchiveFactory()
editor = UserFactory()
archive.add_editor(editor)
Expand All @@ -1372,15 +1368,6 @@ def test_job_list_row_template_ajax_renders(client):
)
job.inputs.set([civ])

algorithm = job.algorithm_image.algorithm

ctrl_data = workstation_session_control_data(
workstation=algorithm.workstation,
context_object=algorithm,
algorithm_job=job,
config=algorithm.workstation_config,
)

headers = {"HTTP_X_REQUESTED_WITH": "XMLHttpRequest"}

response = get_view_for_user(
Expand All @@ -1406,28 +1393,10 @@ def test_job_list_row_template_ajax_renders(client):
"algorithms:job-detail",
kwargs={"slug": job.algorithm_image.algorithm.slug, "pk": job.pk},
)
job_created = str(naturaltime(job.created))

response_content = json.loads(response.content.decode("utf-8"))

assert response.status_code == 200

assert response_content["recordsTotal"] == 1

assert len(response_content["data"]) == 1

assert job_details_url in response_content["data"][0][0]

assert job_created in response_content["data"][0][1]

assert algorithm.title in response_content["data"][0][2]

assert job.get_status_display() in response_content["data"][0][3]

assert "Result and images are private" in response_content["data"][0][4]

assert job.comment in response_content["data"][0][5]

assert "Empty" in response_content["data"][0][6]

assert ctrl_data in response_content["data"][0][7]

0 comments on commit 281984b

Please sign in to comment.