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

add priority buttons to Ingest

parent 113b5501
Branches
No related tags found
3 merge requests!333get all the new changes from master into the branch,!330still a bug,!328Solving Feature SDCP-239
Pipeline #68345 passed
......@@ -5,6 +5,11 @@
Workflow
<a href="{% url 'sort-tasks' 'workflow' 'ingest' %}" class="btn btn-light btn-sm" role="button"><i class="fas fa-sort-down"></i></a>
</th>
<th>
<a href="{% url 'sort-tasks' '-priority' 'ingest' %}" class="btn btn-light btn-sm" role="button"><i class="fas fa-sort-up"></i></a>
Priority
<a href="{% url 'sort-tasks' 'priority' 'ingest' %}" class="btn btn-light btn-sm" role="button"><i class="fas fa-sort-down"></i></a>
</th>
<th>Status</th>
<th>
<a href="{% url 'sort-tasks' '-project' 'ingest' %}" class="btn btn-light btn-sm" role="button"><i class="fas fa-sort-up"></i></a>
......
......@@ -12,6 +12,15 @@
target="_blank"><i class="fas fa-project-diagram"></i> {{ task.workflow.id }}
</a></td>
</td>
<td>
{% if user.is_authenticated %}
<a href="{% url 'task-change-priority-sasid' task.pk '-10' my_tasks.number %}" class="btn btn-warning btn-sm" role="button">-10</a>
{% endif %}
{{ task.priority }}
{% if user.is_authenticated %}
<a href="{% url 'task-change-priority-sasid' task.pk '10' my_tasks.number %}" class="btn btn-warning btn-sm" role="button">+10</a>
{% endif %}
</td>
<td>{{ task.sasid_ingested_fraction.status }}</td>
<td>{{ task.project }}</td>
......
......@@ -106,6 +106,8 @@ urlpatterns = [
path('tasks/<int:pk>/change_priority/<priority_change>/<page>', views.ChangePriority, name='task-change-priority'),
path('tasks/<int:pk>/change_priority/<priority_change>', views.ChangePriority, name='task-change-priority'),
path('tasks/<int:pk>/change_priority_sasid/<priority_change>/<page>', views.ChangePrioritySasID, name='task-change-priority-sasid'),
path('tasks/sort-tasks/<sort>/<redirect_to_page>', views.SortTasks, name='sort-tasks'),
path('tasks/set_filter/<filter>/<redirect_to_page>', views.TaskSetFilter, name='task-set-filter'),
path('tasks/set_active_filter/<redirect_to_page>', views.TaskSetActiveFilter, name='task-set-active-filter'),
......
......@@ -1366,7 +1366,6 @@ def TaskClearFilter(request, redirect_to_page):
@login_required
def ChangePriority(request, pk, priority_change, page=0):
model = Task
task = Task.objects.get(pk=pk)
priority = task.priority + int(priority_change)
......@@ -1383,6 +1382,24 @@ def ChangePriority(request, pk, priority_change, page=0):
# redirect to tasks list
return redirect_with_params('index', '?page=' + page)
@login_required
def ChangePrioritySasID(request, pk, priority_change, page=0):
task = Task.objects.get(pk=pk)
tasks = Task.objects.filter(sas_id=task.sas_id)
for task in tasks:
priority = task.priority + int(priority_change)
if priority < 0:
priority = 0
task.priority = priority
task.save()
return redirect('ingest')
def SortTasks(request, sort, redirect_to_page):
# store the sort field on the session
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment