view examples/collect_demo2.py @ 17:adca5b3780d2

Add collecting no-prio issues. Restructure. * Move usage examples from collect_issues.py to examples/. Also add a section about this to the readme. This should make it easier to understand how it all works together. As we have two examples now, hardcode the database filenames. * Add a function to create the necessary database command from a list of columns. This makes it easier to work with tracker that have customized their priorities, * Add an example how to collect no-prio issues in a database. Note that the display part is not included. * Cleanup roundup_content_data by removing db file name suggestions and unused "reference db" command. This could be re-added for specific installations if they need it, however it probably should be separated as configuration.
author Bernhard Reiter <bernhard@intevation.de>
date Mon, 09 Jul 2018 12:28:28 +0200
parents
children
line wrap: on
line source
#!/usr/bin/env python3
"""Connect to roundup-tracker and save status to db for example demo2.

Run periodically as often as you want data points to be saved.
demo2 tracks issue without priority in column `None`.
"""
from collect_issues import save_stats_in_db
import roundup_content_data as rcd

BASE_URL_DEMO = "http://localhost:8917/demo/"
SEARCH_URL_DEMO = "issue?@action=export_csv&@columns=title,priority&@filter=status&@pagesize=50&@startwith=0&status=-1,1,2,3,4,5,6,7"

LOGIN_PARAMETERS_DEMO = (
    ("__login_name", "demo"),
    ("__login_password", "demo"),
    ("@action", "Login"),
    )

list_of_columns = ['critical', 'major', 'normal', 'minor', 'wishlist']
data_dict = { key: [] for key in list_of_columns }

# To track issues without prio we need to add an extra column in the db cmds.
select_all, select_where, create_db, insert_new = \
    rcd.build_sql_commands(list_of_columns + ['None'])

# We enable the extra colum with `include_no_prio=True`
save_stats_in_db(LOGIN_PARAMETERS_DEMO, BASE_URL_DEMO, "./demo2.db",
                 list_of_columns, create_db, insert_new,
                 SEARCH_URL_DEMO, include_no_prio=True)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)