diff examples/collect_demo3.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
children 7a523e13fcb3
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/collect_demo3.py	Mon Oct 22 16:49:58 2018 +0200
@@ -0,0 +1,46 @@
+#!/usr/bin/env python3
+"""Connect to roundup-tracker and save status to db for example demo1.
+
+Run periodically as often as you want data points to be saved.
+demo1 only tracks issues with a priority.
+"""
+
+import json
+import configparser
+from collect_issues import save_stats_in_db
+import roundup_content_data as rcd
+
+COLUMNS = "critical, urgent, bug, feature, wish"
+
+config = configparser.ConfigParser()
+config.read('config3.ini')
+
+base_url = config.get("URL", "BaseURL")
+
+user = config.get("LOGIN","Username")
+password = config.get("LOGIN", "Password")
+
+LOGIN_PARAMETERS_DEMO = (
+    ("__login_name", user),
+    ("__login_password", password),
+    ("@action", "Login"),
+    )
+
+database_file = config.get("DB", "DatabaseFile")
+
+keywords = config.get("SEARCH", "Keywords", fallback="").split(", ")
+
+list_of_columns = config.get("SEARCH", "Columns", fallback=COLUMNS).split(", ")
+
+status = config.get("SEARCH", "Status", fallback="").split(", ")
+
+include_no_prio = config.getboolean("SEARCH", "IncludeNoPrio", fallback= False)
+
+if include_no_prio:
+    list_of_columns += ["None"]
+
+select_all, select_where, create_db, insert_new = \
+    rcd.build_sql_commands(list_of_columns)
+
+save_stats_in_db(LOGIN_PARAMETERS_DEMO, base_url, database_file,
+                list_of_columns, create_db, insert_new, keywords, status)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)