From f53dffa2ef8ea8884ca82bb8e9abe4edee4ba781 Mon Sep 17 00:00:00 2001
From: Vermaas <vermaas@astron.nl>
Date: Mon, 28 Aug 2023 11:29:36 +0200
Subject: [PATCH] setting up the mechanism

---
 atdb/taskdatabase/services/algorithms.py      | 26 +++++++++++++++++--
 .../templates/taskdatabase/index.html         |  2 +-
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/atdb/taskdatabase/services/algorithms.py b/atdb/taskdatabase/services/algorithms.py
index b4bd4905..4e8cbfa1 100644
--- a/atdb/taskdatabase/services/algorithms.py
+++ b/atdb/taskdatabase/services/algorithms.py
@@ -83,7 +83,7 @@ def convert_logentries_to_html(log_entries):
     results = ""
 
     try:
-        results += '<th>service</th><th>step</th><th>status</th><th width="200pixels">timestamp</th><th>cpu_cycles</th><th>wall_clock_time</th><th>log</th>'
+        results += '<th>service</th><th>step</th><th>status</th><th width="200px">timestamp</th><th>cpu_cycles</th><th>wall_clock_time</th><th>log</th>'
         results += "<tbody>"
         for log in log_entries:
             line = "<tr><td><b>" + str(log.service) + '</b></td>'
@@ -799,7 +799,7 @@ def construct_inspectionplots(task, expand_image="False", source='task_id'):
     return results
 
 
-def construct_summary(task):
+def construct_default_summary(task):
 
     totals = ""
     results = ""
@@ -937,3 +937,25 @@ def construct_summary(task):
     results = title + totals + results
     return results
 
+
+def construct_summary(task):
+
+    # not every workflow has the same summary structure
+    # determine the flavour based on the selected task, and construct the html accordingly
+
+    SUMMARY_FLAVOUR = "default"
+
+    try:
+        summary = task.quality_json["summary"]
+
+        for key in summary:
+            if key == 'details':
+                SUMMARY_FLAVOUR = "imaging"
+    except:
+        pass
+
+
+    html = construct_default_summary(task)
+
+
+    return html
\ No newline at end of file
diff --git a/atdb/taskdatabase/templates/taskdatabase/index.html b/atdb/taskdatabase/templates/taskdatabase/index.html
index 0c25d8e8..01a7d013 100644
--- a/atdb/taskdatabase/templates/taskdatabase/index.html
+++ b/atdb/taskdatabase/templates/taskdatabase/index.html
@@ -31,7 +31,7 @@
             {% include 'taskdatabase/pagination.html' %}
         </div>
     </div>
-    <p class="footer"> Version 22 Aug 2023
+    <p class="footer"> Version 28 Aug 2023
 </div>
 
 {% include 'taskdatabase/refresh.html' %}
-- 
GitLab