diff display_issues.py @ 20:3bb3d9a9f1b7

Filter by keywords and states. Configuration via configuration file. "No prio" grapf is displayed. (./display_issues_demo.py is not yet dynamic, it needs all states)
author Magnus Schieder <mschieder@intevation.de>
date Mon, 22 Oct 2018 16:49:58 +0200
parents adca5b3780d2
children 89469aa41fe1
line wrap: on
line diff
--- a/display_issues.py	Mon Jul 09 14:49:44 2018 +0200
+++ b/display_issues.py	Mon Oct 22 16:49:58 2018 +0200
@@ -40,7 +40,7 @@
 
     return ", ".join(formated)
 
-def get_webpage(graph=None):
+def get_webpage(status, keywords, graph=None):
 
     if graph is None:
         graph = os.path.dirname(os.path.realpath(__file__)) + '/graph.html'
@@ -48,17 +48,21 @@
     with open(graph, "r") as html_chart_file:
         base_html_data = html_chart_file.read()
 
+
     base_html_data = (base_html_data
+        .replace("status", status)
+        .replace("keywords", keywords)
         .replace("var critical=[];", "var critical=[" + make_js_object_string(rcd.data_dict["critical"]) + "]")
         .replace("var urgent=[];", "var urgent=[" + make_js_object_string(rcd.data_dict["urgent"]) + "]")
         .replace("var bug=[];", "var bug=[" + make_js_object_string(rcd.data_dict["bug"]) + "]")
         .replace("var feature=[];", "var feature=[" + make_js_object_string(rcd.data_dict["feature"]) + "]")
         .replace("var wish=[];", "var wish=[" + make_js_object_string(rcd.data_dict["wish"]) + "]")
+        .replace("var noPrio=[];", "var noPrio=[" + make_js_object_string(rcd.data_dict["noPrio"]) + "]")
         .replace("var timestamp=[];", "var timestamp=[" + make_js_object_date(rcd.data_dict["date"]) + "]"))
 
     return base_html_data
 
-def compile_db_stats_html(db_file, sql_select, graph=None):
+def compile_db_stats_html(db_file, sql_select, status="", keywords="", graph=None):
 
     con = None
     cur = None
@@ -75,20 +79,21 @@
             rcd.data_dict["bug"].append(row[3])
             rcd.data_dict["feature"].append(row[4])
             rcd.data_dict["wish"].append(row[5])
+            rcd.data_dict["noPrio"].append(row[6])
     finally:
         if cur:
             cur.close()
         if con:
             con.close()
 
-    return get_webpage(graph)
+    return get_webpage(status, keywords, graph)
 
 def render_webpage(content):
     for line in content.split("\n"):
         print(line)
 
-def render_db_stats_as_html(db_file, sql_select):
-    render_webpage(compile_db_stats_html(db_file, sql_select))
+def render_db_stats_as_html(db_file, sql_select, status="", keywords=""):
+    render_webpage(compile_db_stats_html(db_file, sql_select, status, keywords))
 
 if __name__ == '__main__':
     cgitb.enable()
@@ -96,4 +101,4 @@
     #print("Content-Type: text/html")
     #print()
 
-    render_db_stats_as_html("./demo1.db", rcd.SELECT_ALL)
+    render_db_stats_as_html("./demo3.db", rcd.SELECT_ALL)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)