Mercurial > roundup-cc
annotate display_issues_demo.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 | 89469aa41fe1 |
children | 761ee2351f58 |
rev | line source |
---|---|
3
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
2 |
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
3 """ Fetch issues from a roundup-tracker and save them in a databse. |
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
4 |
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
5 author: Sascha L. Teichmann <sascha.teichmann@intevation.de> |
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
6 author: Bernhard Reiter <bernhard@intevation.de> |
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
7 author: Sean Engelhardt <sean.engelhardt@intevation.de> |
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
8 |
17
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
13
diff
changeset
|
9 (c) 2010, 2015, 2018 by Intevation GmbH |
3
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
10 |
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
11 This is Free Software unter the terms of the |
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
12 GNU GENERAL PUBLIC LICENSE Version 3 or later. |
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
13 See http://www.gnu.org/licenses/gpl-3.0.txt for details |
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
14 """ |
20
3bb3d9a9f1b7
Filter by keywords and states.
Magnus Schieder <mschieder@intevation.de>
parents:
17
diff
changeset
|
15 import configparser |
21
7a523e13fcb3
Argpars added for the configuration file.
Magnus Schieder <mschieder@intevation.de>
parents:
20
diff
changeset
|
16 import argparse |
20
3bb3d9a9f1b7
Filter by keywords and states.
Magnus Schieder <mschieder@intevation.de>
parents:
17
diff
changeset
|
17 from display_issues import * |
3
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
18 |
25
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
19 STATES = "unread, deferred, chatting, need_eg, in_progress, testing, done_cbb, resolved" |
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
20 |
21
7a523e13fcb3
Argpars added for the configuration file.
Magnus Schieder <mschieder@intevation.de>
parents:
20
diff
changeset
|
21 parser = argparse.ArgumentParser() |
7a523e13fcb3
Argpars added for the configuration file.
Magnus Schieder <mschieder@intevation.de>
parents:
20
diff
changeset
|
22 parser.add_argument("config_file", type=str, metavar="[config file]") |
7a523e13fcb3
Argpars added for the configuration file.
Magnus Schieder <mschieder@intevation.de>
parents:
20
diff
changeset
|
23 args = parser.parse_args() |
7a523e13fcb3
Argpars added for the configuration file.
Magnus Schieder <mschieder@intevation.de>
parents:
20
diff
changeset
|
24 |
20
3bb3d9a9f1b7
Filter by keywords and states.
Magnus Schieder <mschieder@intevation.de>
parents:
17
diff
changeset
|
25 config = configparser.ConfigParser() |
21
7a523e13fcb3
Argpars added for the configuration file.
Magnus Schieder <mschieder@intevation.de>
parents:
20
diff
changeset
|
26 config.read(args.config_file) |
20
3bb3d9a9f1b7
Filter by keywords and states.
Magnus Schieder <mschieder@intevation.de>
parents:
17
diff
changeset
|
27 |
21
7a523e13fcb3
Argpars added for the configuration file.
Magnus Schieder <mschieder@intevation.de>
parents:
20
diff
changeset
|
28 db = config.get("DB", "DatabaseFile") |
20
3bb3d9a9f1b7
Filter by keywords and states.
Magnus Schieder <mschieder@intevation.de>
parents:
17
diff
changeset
|
29 keywords = config.get("SEARCH", "Keywords", fallback="") |
25
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
30 |
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
31 |
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
32 |
20
3bb3d9a9f1b7
Filter by keywords and states.
Magnus Schieder <mschieder@intevation.de>
parents:
17
diff
changeset
|
33 status = config.get("SEARCH", "Status", fallback="") |
3bb3d9a9f1b7
Filter by keywords and states.
Magnus Schieder <mschieder@intevation.de>
parents:
17
diff
changeset
|
34 columns = config.get("SEARCH", "Columns", fallback="critical, urgent, bug, feature, wish") |
3bb3d9a9f1b7
Filter by keywords and states.
Magnus Schieder <mschieder@intevation.de>
parents:
17
diff
changeset
|
35 noPrio = config.get("SEARCH", "IncludeNoPrio", fallback=False) |
25
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
36 search = config.get("SEARCH", "Search", fallback="prio") |
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
37 if search == "status": |
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
38 if status == "": |
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
39 columns = STATES |
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
40 else: |
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
41 columns = status |
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
42 noPrio = False |
7161ce4e7ab1
The web-based display is dynamically generated.
Magnus Schieder <mschieder@intevation.de>
parents:
24
diff
changeset
|
43 |
20
3bb3d9a9f1b7
Filter by keywords and states.
Magnus Schieder <mschieder@intevation.de>
parents:
17
diff
changeset
|
44 if noPrio: |
3bb3d9a9f1b7
Filter by keywords and states.
Magnus Schieder <mschieder@intevation.de>
parents:
17
diff
changeset
|
45 columns += ", None" |
3
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
46 |
99c68ebfb3b9
Streamlined to example use.
Bernhard Reiter <bernhard@intevation.de>
parents:
diff
changeset
|
47 cgitb.enable() # (optional) HTML traceback to browser |
17
adca5b3780d2
Add collecting no-prio issues. Restructure.
Bernhard Reiter <bernhard@intevation.de>
parents:
13
diff
changeset
|
48 #render_db_stats_as_html("./demo1.db", rcd.SELECT_ALL) |
21
7a523e13fcb3
Argpars added for the configuration file.
Magnus Schieder <mschieder@intevation.de>
parents:
20
diff
changeset
|
49 render_db_stats_as_html(db, |
20
3bb3d9a9f1b7
Filter by keywords and states.
Magnus Schieder <mschieder@intevation.de>
parents:
17
diff
changeset
|
50 rcd.build_sql_select(columns).format("timestamp > date('now', '-2 month')"), |
24
89469aa41fe1
Preliminary work to make the display more dynamic.
Magnus Schieder <mschieder@intevation.de>
parents:
21
diff
changeset
|
51 columns, status, keywords) |