comparison roundup_cc.py @ 25:7161ce4e7ab1

The web-based display is dynamically generated. * All graphs are passed in one object. All graphs are passed in one object. The graphs are generated iteratiev and assigned a color. * roundup_cc.py can count how many issues are in which state.
author Magnus Schieder <mschieder@intevation.de>
date Mon, 12 Nov 2018 18:03:26 +0100
parents
children 761ee2351f58
comparison
equal deleted inserted replaced
24:89469aa41fe1 25:7161ce4e7ab1
1 #!/usr/bin/env python3
2 """Connect to roundup-tracker and save status to db.
3
4 Run periodically as often as you want data points to be saved.
5 """
6
7 import configparser
8 import argparse
9
10 from collect_issues import save_stats_in_db
11 import roundup_content_data as rcd
12
13 PRIO = "critical, urgent, bug, feature, wish"
14 STATES = "unread, deferred, chatting, need_eg, in_progress, testing, done_cbb, resolved"
15
16 def main():
17
18 parser = argparse.ArgumentParser()
19 parser.add_argument("config_file", type=str, metavar="[config file]")
20 args = parser.parse_args()
21
22 config = configparser.ConfigParser()
23 config.read(args.config_file)
24
25 base_url = config.get("URL", "BaseURL")
26
27 user = config.get("LOGIN","Username")
28 password = config.get("LOGIN", "Password")
29
30 login_parameters = (
31 ("__login_name", user),
32 ("__login_password", password),
33 ("@action", "Login"),
34 )
35
36 database_file = config.get("DB", "DatabaseFile")
37
38 keywords = config.get("SEARCH", "Keywords", fallback="").split(", ")
39
40 search = config.get("SEARCH", "Search", fallback="prio")
41 if search == "prio":
42 list_of_columns = config.get("SEARCH", "Columns", fallback=PRIO).split(", ")
43 status = config.get("SEARCH", "Status", fallback="").split(", ")
44 include_no_prio = config.getboolean("SEARCH", "IncludeNoPrio", fallback= False)
45 if include_no_prio:
46 list_of_columns += ["None"]
47
48 elif search == "status":
49 list_of_columns = config.get("SEARCH", "Status", fallback=STATES).split(", ")
50 status = [""]
51
52 select_all, select_where, create_db, insert_new = \
53 rcd.build_sql_commands(list_of_columns)
54
55 save_stats_in_db(search, login_parameters, base_url, database_file,
56 list_of_columns, create_db, insert_new, keywords, status)
57
58 if __name__ == '__main__':
59 main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)