# HG changeset patch # User Magnus Schieder # Date 1542986004 -3600 # Node ID 80bbd06fe8ecc6cc42a2a27c8e1da030c4cd69a4 # Parent 9aca070c86bd0b24f2f8d6dec98a81b10ce29af0 Add Comments diff -r 9aca070c86bd -r 80bbd06fe8ec collect_issues.py --- a/collect_issues.py Thu Nov 22 19:34:53 2018 +0100 +++ b/collect_issues.py Fri Nov 23 16:13:24 2018 +0100 @@ -4,7 +4,7 @@ author: Sascha L. Teichmann author: Bernhard Reiter author: Sean Engelhardt - +author: Magnus Schieder (c) 2010, 2015, 2018 by Intevation GmbH This is Free Software unter the terms of the @@ -28,12 +28,12 @@ CHECK_KEYWORD_VALUES = "keyword?@action=export_csv&@columns=id,name" # Getting states and their ids. CHECK_STATUS_VALUES = "status?@action=export_csv&@columns=id,name" -# Getting priority and their ids. +# Getting priorities and their ids. CHECK_PRIO_VALUES = "priority?@action=export_csv&@columns=id,name" -# Getting the priority of each issue with the filter status ,keywords ,priority +# Getting the priority of each issue with the filter status, keyword ,priority SEARCH_ROUNDUP_PRIO = "issue?@action=export_csv&@columns=priority&@filter=status,keyword,priority&@pagesize=500&@startwith=0&status={status_values}&keyword={keyword_values}&priority={priority_values}" -# Getting the status of each issue with the filter keywords, status +# Getting the status of each issue with the filter keyword, priority, status SEARCH_ROUNDUP_STATUS = "issue?@action=export_csv&@columns=status&@filter=priority,keyword,status&@pagesize=500&@startwith=0&priority={priority_values}&keyword={keyword_values}&status={status_values}" @@ -74,6 +74,9 @@ con.close() def get_ids(opener, baseurl, parameter, url, include_no_prio=False): + """Returns the IDs of the respective search parameters as string and list. + """ + if parameter == [""]: return ("", []) @@ -99,8 +102,8 @@ def issues_to_quantities(issue_csv, columns_ids): """Count issues per priority. - Returns: a list of ints, containing how often a prio occurred [:-1] - in order of the priorities, with the last being the "None" prio + Returns: a list of ints, containing how often a prio/status occurred + in the order in which they are specified in the config. """ order_dict = {} @@ -117,7 +120,7 @@ if priority in order_dict: if priority.isdigit() == True : quantities[order_dict[priority]] += 1 - else: + else: # no priority set quantities[-1] += 1 #print("quantities : " + str(quantities)) @@ -155,7 +158,7 @@ CHECK_KEYWORD_VALUES) if search == "prio": - # search_parameters are statuses. + # search_parameters are states. status_ids_url, _ = get_ids(opener, baseurl,search_parameters , CHECK_STATUS_VALUES, include_no_prio) prio_ids_url, columns_ids = get_ids(opener, baseurl, columns, @@ -180,7 +183,7 @@ formated_search_url) opener.close() - print(baseurl + formated_search_url) + #print(baseurl + formated_search_url) quantities = issues_to_quantities(current_issues_csv, columns_ids) diff -r 9aca070c86bd -r 80bbd06fe8ec display_issues.py --- a/display_issues.py Thu Nov 22 19:34:53 2018 +0100 +++ b/display_issues.py Fri Nov 23 16:13:24 2018 +0100 @@ -5,8 +5,8 @@ author: Sascha L. Teichmann author: Bernhard Reiter author: Sean Engelhardt - -(c) 2010,2015 by Intevation GmbH +author: Magnus Schieder +(c) 2010,2015,2018 by Intevation GmbH This is Free Software unter the terms of the GNU GENERAL PUBLIC LICENSE Version 3 or later. @@ -41,6 +41,7 @@ return ", ".join(formated) def get_webpage(data_dict, columns, search_parameters, keywords, graph=None): + """Returns the website with inserted data.""" if graph is None: graph = os.path.dirname(os.path.realpath(__file__)) + '/graph.html' @@ -51,7 +52,7 @@ if "None" not in columns: data_dict["None"] = [0] - + # Converts the data to a JS object. js_data_dickt ="{" for col in columns.split(", "): js_data_dickt += col + ":[" + make_js_object_string(data_dict[col]) + "]," diff -r 9aca070c86bd -r 80bbd06fe8ec roundup_cc.py --- a/roundup_cc.py Thu Nov 22 19:34:53 2018 +0100 +++ b/roundup_cc.py Fri Nov 23 16:13:24 2018 +0100 @@ -10,7 +10,9 @@ from collect_issues import save_stats_in_db import roundup_content_data as rcd +# Default priorities of 'roundup'. PRIO = "critical, urgent, bug, feature, wish" +# Default statuses of 'roundup'. STATES = "unread, deferred, chatting, need-eg, in-progress, testing, done-cbb, resolved" def main(): @@ -22,6 +24,7 @@ config = configparser.ConfigParser() config.read(args.config_file) + # URL of the issue tracker base_url = config.get("URL", "BaseURL") user = config.get("LOGIN","Username") @@ -47,7 +50,6 @@ elif search == "status": list_of_columns = config.get("SEARCH", "Status", fallback=STATES).split(", ") - # statsu = columns Must change search_parameters = config.get("SEARCH", "Priority", fallback="").split(", ") if include_no_prio: search_parameters += ["None"] @@ -66,7 +68,8 @@ rcd.build_sql_commands(sql_list_of_columns) save_stats_in_db(search, login_parameters, base_url, database_file, - list_of_columns, create_db, insert_new, keywords, search_parameters, include_no_prio) + list_of_columns, create_db, insert_new, keywords, + search_parameters, include_no_prio) if __name__ == '__main__': main() diff -r 9aca070c86bd -r 80bbd06fe8ec roundup_cc_display.py --- a/roundup_cc_display.py Thu Nov 22 19:34:53 2018 +0100 +++ b/roundup_cc_display.py Fri Nov 23 16:13:24 2018 +0100 @@ -5,6 +5,7 @@ author: Sascha L. Teichmann author: Bernhard Reiter author: Sean Engelhardt +author: Magnus Schieder (c) 2010, 2015, 2018 by Intevation GmbH @@ -30,7 +31,6 @@ db = config.get("DB", "DatabaseFile") keywords = config.get("SEARCH", "Keywords", fallback="") - search = config.get("SEARCH", "Search", fallback="prio") if search == "prio": search_parameters = config.get("SEARCH", "Status", fallback="")