annotate doc/collect_demo2.py @ 36:59e1659a0a0b tip

Update 'TODO.creole' * Old TODOs moved to 'doc/old_TODO.creole'
author Magnus Schieder <mschieder@intevation.de>
date Mon, 26 Nov 2018 16:52:45 +0100
parents 916fa83b4144
children
rev   line source
17
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
1 #!/usr/bin/env python3
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
2 """Connect to roundup-tracker and save status to db for example demo2.
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
3
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
4 Run periodically as often as you want data points to be saved.
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
5 demo2 tracks issue without priority in column `None`.
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
6 """
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
7 from collect_issues import save_stats_in_db
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
8 import roundup_content_data as rcd
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
9
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
10 BASE_URL_DEMO = "http://localhost:8917/demo/"
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
11 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"
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
12
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
13 LOGIN_PARAMETERS_DEMO = (
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
14 ("__login_name", "demo"),
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
15 ("__login_password", "demo"),
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
16 ("@action", "Login"),
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
17 )
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
18
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
19 list_of_columns = ['critical', 'major', 'normal', 'minor', 'wishlist']
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
20 data_dict = { key: [] for key in list_of_columns }
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
21
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
22 # To track issues without prio we need to add an extra column in the db cmds.
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
23 select_all, select_where, create_db, insert_new = \
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
24 rcd.build_sql_commands(list_of_columns + ['None'])
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
25
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
26 # We enable the extra colum with `include_no_prio=True`
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
27 save_stats_in_db(LOGIN_PARAMETERS_DEMO, BASE_URL_DEMO, "./demo2.db",
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
28 list_of_columns, create_db, insert_new,
adca5b3780d2 Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff changeset
29 SEARCH_URL_DEMO, include_no_prio=True)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)