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

Merge branch 'SDC-898-annotations' into 'SDC-957-automate-validation'

add 'remove' button in annotations modal

See merge request !303
parents 0f595da7 0b405acf
Branches
No related tags found
3 merge requests!304update branch with master,!303add 'remove' button in annotations modal,!302automatic quality validation
Pipeline #52170 passed
......@@ -59,10 +59,10 @@ def get_min_start_and_max_end_time(sas_id):
tasks = Task.objects.filter(sas_id=sas_id)
for task in tasks:
try:
# If more entrees are found for 'processing' task, get the latest
# If more entries are found for 'processing' task, get the latest
latest_start_time = LogEntry.objects.filter(task=task.pk).filter(step_name='running').filter(status='processing').latest('timestamp')
start_time = latest_start_time.timestamp
# If more entrees are found for 'processed' task, get the latest
# If more entries are found for 'processed' task, get the latest
lastest_end_time = LogEntry.objects.filter(task=task.pk).filter(step_name='running').filter(status='processed').latest('timestamp')
end_time = lastest_end_time.timestamp
if min_start_time is None:
......@@ -842,7 +842,7 @@ def construct_summary(task):
line += '<td colspan="2">' + str(round(record['size_ratio'],3)) + '</td>'
line += '</tr>'
if 'rfi_percent' in record.keys():
if 'rfi_percent' in record:
# add RFI percentage (if present)
rfi = record['rfi_percent']
line += '<tr><td><b>RFI percentage</b></td>'
......
......@@ -13,6 +13,8 @@
{{ form }}
</div>
<div><button class="btn btn-success btn-sm" type="submit"><i class="fas fa-check"></i> OK</button>
<a href="{% url 'clear-annotations-sasid' task.id %}" class="btn btn-danger btn-sm" role="button"><i class="fas fa-trash-alt"></i> Remove</a>&nbsp
<a href="{% url 'validation' %}" class="btn btn-warning btn-sm" role="button"><i class="fas fa-times-circle"></i> Cancel</a>&nbsp
</div>
</form>
......
......@@ -31,6 +31,8 @@ urlpatterns = [
path('annotate_quality_sasid/<int:id>', views.AnnotateQualitySasId, name='annotate-quality-sasid'),
path('annotate_quality_sasid/<int:id>/<page>', views.AnnotateQualitySasId, name='annotate-quality-sasid'),
path('show_inspectionplots/<int:id>/<page>', views.ShowInspectionPlots, name='inspection-plots'),
path('clear_annotations_sasid/<int:id>', views.ClearAnnotationsSasID, name='clear-annotations-sasid'),
path('clear_annotations_sasid/<int:id>/<page>', views.ClearAnnotationsSasID, name='clear-annotations-sasid'),
path('show_inspectionplots_sasid/<int:id>/<expand_image>', views.ShowInspectionPlotsSasId, name='inspection-plots-sasid'),
path('show_summary/<int:id>/<page>', views.ShowSummarySasId, name='summary'),
......
......@@ -677,6 +677,23 @@ def AnnotateQualitySasId(request, id=0, page=0):
return render(request, "taskdatabase/validation/annotate_quality_sasid.html",
{'task': task, 'page': page, 'form': form})
def ClearAnnotationsSasID(request, id=0):
task = Task.objects.get(id=id)
tasks = Task.objects.filter(sas_id=task.sas_id)
for task in tasks:
try:
task.remarks['quality_sasid'] = None
except:
task.remarks = {}
task.remarks['quality_sasid'] = None
task.save()
return redirect('validation')
def ShowInspectionPlots(request, id=0, page=0):
# a GET means that the form should be presented to be filled in
task = Task.objects.get(id=id)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment