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

add 'remove' button in annotations modal

parent 0f595da7
Branches
Tags
3 merge requests!304update branch with master,!303add 'remove' button in annotations modal,!302automatic quality validation
Pipeline #52169 passed
...@@ -59,10 +59,10 @@ def get_min_start_and_max_end_time(sas_id): ...@@ -59,10 +59,10 @@ def get_min_start_and_max_end_time(sas_id):
tasks = Task.objects.filter(sas_id=sas_id) tasks = Task.objects.filter(sas_id=sas_id)
for task in tasks: for task in tasks:
try: 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') latest_start_time = LogEntry.objects.filter(task=task.pk).filter(step_name='running').filter(status='processing').latest('timestamp')
start_time = latest_start_time.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') lastest_end_time = LogEntry.objects.filter(task=task.pk).filter(step_name='running').filter(status='processed').latest('timestamp')
end_time = lastest_end_time.timestamp end_time = lastest_end_time.timestamp
if min_start_time is None: if min_start_time is None:
...@@ -842,7 +842,7 @@ def construct_summary(task): ...@@ -842,7 +842,7 @@ def construct_summary(task):
line += '<td colspan="2">' + str(round(record['size_ratio'],3)) + '</td>' line += '<td colspan="2">' + str(round(record['size_ratio'],3)) + '</td>'
line += '</tr>' line += '</tr>'
if 'rfi_percent' in record.keys(): if 'rfi_percent' in record:
# add RFI percentage (if present) # add RFI percentage (if present)
rfi = record['rfi_percent'] rfi = record['rfi_percent']
line += '<tr><td><b>RFI percentage</b></td>' line += '<tr><td><b>RFI percentage</b></td>'
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
{{ form }} {{ form }}
</div> </div>
<div><button class="btn btn-success btn-sm" type="submit"><i class="fas fa-check"></i> OK</button> <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 <a href="{% url 'validation' %}" class="btn btn-warning btn-sm" role="button"><i class="fas fa-times-circle"></i> Cancel</a>&nbsp
</div> </div>
</form> </form>
......
...@@ -31,6 +31,8 @@ urlpatterns = [ ...@@ -31,6 +31,8 @@ urlpatterns = [
path('annotate_quality_sasid/<int:id>', views.AnnotateQualitySasId, name='annotate-quality-sasid'), 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('annotate_quality_sasid/<int:id>/<page>', views.AnnotateQualitySasId, name='annotate-quality-sasid'),
path('show_inspectionplots/<int:id>/<page>', views.ShowInspectionPlots, name='inspection-plots'), 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_inspectionplots_sasid/<int:id>/<expand_image>', views.ShowInspectionPlotsSasId, name='inspection-plots-sasid'),
path('show_summary/<int:id>/<page>', views.ShowSummarySasId, name='summary'), path('show_summary/<int:id>/<page>', views.ShowSummarySasId, name='summary'),
......
...@@ -677,6 +677,23 @@ def AnnotateQualitySasId(request, id=0, page=0): ...@@ -677,6 +677,23 @@ def AnnotateQualitySasId(request, id=0, page=0):
return render(request, "taskdatabase/validation/annotate_quality_sasid.html", return render(request, "taskdatabase/validation/annotate_quality_sasid.html",
{'task': task, 'page': page, 'form': form}) {'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): def ShowInspectionPlots(request, id=0, page=0):
# a GET means that the form should be presented to be filled in # a GET means that the form should be presented to be filled in
task = Task.objects.get(id=id) 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