From c9af16ce37ccfbf75183ed0214e3a52a9d91dcc7 Mon Sep 17 00:00:00 2001
From: Frederick Muriuki Muriithi
Date: Mon, 16 Oct 2023 14:41:39 +0300
Subject: Indicate progress for data insert.
---
qc_app/templates/insert_progress.html | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
(limited to 'qc_app/templates/insert_progress.html')
diff --git a/qc_app/templates/insert_progress.html b/qc_app/templates/insert_progress.html
index 52beaa4..0e1a9e0 100644
--- a/qc_app/templates/insert_progress.html
+++ b/qc_app/templates/insert_progress.html
@@ -13,9 +13,21 @@
{{job_status}}: {{message}}
+{%if job.get("stdout", "").split("\n\n") | length < 3 %}
+{%set lines = 0%}
+{%else%}
+{%set lines = (job.get("stdout", "").split("\n\n") | length / 3) %}
+{%endif%}
+{%set totallines = job.get("totallines", lines+3) | int %}
+{%if totallines > 1000 %}
+{%set fraction = ((lines*1000)/totallines) %}
+{%else%}
+{%set fraction = (lines/totallines)%}
+{%endif%}
+
-
-{{"%.2f" | format(job['percent'] | float)}}%
+
+{{"%.2f" | format(fraction * 100 | float)}}%
{{stdout_output(job)}}
--
cgit v1.2.3