Skip to content
Snippets Groups Projects
Commit 1ab5a2a3 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

quality buttons are only available when all tasks of a sas_id are stored

parent 1031a143
No related branches found
No related tags found
No related merge requests found
Pipeline #44892 passed
......@@ -10,6 +10,7 @@ logger = logging.getLogger(__name__)
# constants
datetime_format_string = '%Y-%m-%dT%H:%M:%SZ'
verified_statusses = ['stored','validated','scrubbed','archived','finished']
class Workflow(models.Model):
description = models.CharField(max_length=500, blank=True, null=True)
......@@ -225,10 +226,15 @@ class Task(models.Model):
except:
return None
@property
def sasid_has_same_status(self):
nr_of_statusses = Task.objects.filter(sas_id=self.sas_id).distinct("status").count()
return nr_of_statusses == 1
def sasid_is_verified(self):
for task in Task.objects.filter(sas_id=self.sas_id):
if task.status not in verified_statusses:
return False
return True
class LogEntry(models.Model):
cpu_cycles = models.IntegerField(null=True,blank=True)
......
......@@ -34,7 +34,7 @@
{% include 'taskdatabase/pagination.html' %}
</div>
</div>
<p class="footer"> Version 21 Februari 2023
<p class="footer"> Version 27 Februari 2023
</div>
......
{% if task.sasid_has_same_status %}
{% if task.sasid_is_verified %}
<a href="{% url 'task-validate-view' task.pk 'poor' 'validated' my_tasks.number %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-check"></i> P</a>
{% endif %}
{% if task.sasid_has_same_status %}
{% if task.sasid_is_verified %}
<a href="{% url 'task-validate-view' task.pk 'moderate' 'validated' my_tasks.number %}" class="btn btn-warning btn-sm" role="button"><i class="fas fa-check"></i> M</a>
{% endif %}
{% if task.sasid_has_same_status %}
{% if task.sasid_is_verified %}
<a href="{% url 'task-validate-view' task.pk 'good' 'validated' my_tasks.number %}" class="btn btn-success btn-sm" role="button"><i class="fas fa-check"></i> G</a>
{% endif %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment