# HG changeset patch # User Magnus Schieder # Date 1542911693 -3600 # Node ID 9aca070c86bd0b24f2f8d6dec98a81b10ce29af0 # Parent 0d6504d02a6bd54a1e15b42960947679315772ef Add the filter 'priority' for the search by status. diff -r 0d6504d02a6b -r 9aca070c86bd collect_issues.py --- a/collect_issues.py Thu Nov 22 14:07:55 2018 +0100 +++ b/collect_issues.py Thu Nov 22 19:34:53 2018 +0100 @@ -34,7 +34,7 @@ # Getting the priority of each issue with the filter status ,keywords ,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 -SEARCH_ROUNDUP_STATUS = "issue?@action=export_csv&@columns=status&@filter=keyword,status&@pagesize=500&@startwith=0&keyword={keyword_values}&status={status_values}" +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}" def connect_to_server(params, baseurl): @@ -146,27 +146,41 @@ con.close() -def save_stats_in_db(search, login_parmeters, baseurl, db_file, columns, sql_create_db, sql_insert_in_db, keywords, status, include_no_prio): +def save_stats_in_db(search, login_parmeters, baseurl, db_file, columns, sql_create_db, sql_insert_in_db, keywords, search_parameters, include_no_prio): try: opener = connect_to_server(login_parmeters, baseurl) - keywords_ids_url, _ = get_ids(opener, baseurl, keywords, CHECK_KEYWORD_VALUES) + keywords_ids_url, _ = get_ids(opener, baseurl, keywords, + CHECK_KEYWORD_VALUES) if search == "prio": - status_ids_url, _ = get_ids(opener, baseurl, status, CHECK_STATUS_VALUES, include_no_prio) - prio_ids_url, columns_ids = get_ids(opener, baseurl, columns, CHECK_PRIO_VALUES, include_no_prio) - formated_search_url = SEARCH_ROUNDUP_PRIO.format(status_values=status_ids_url, - keyword_values=keywords_ids_url, priority_values=prio_ids_url) + # search_parameters are statuses. + 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, + CHECK_PRIO_VALUES, include_no_prio) + formated_search_url = SEARCH_ROUNDUP_PRIO.format( + status_values=status_ids_url, + keyword_values=keywords_ids_url, + priority_values=prio_ids_url) + elif search == "status": - status_ids_url, columns_ids = get_ids(opener, baseurl, columns, CHECK_STATUS_VALUES) - formated_search_url = SEARCH_ROUNDUP_STATUS.format(keyword_values=keywords_ids_url, + # search_parameters are priorities. + prio_ids_url, _ = get_ids(opener, baseurl, search_parameters, + CHECK_PRIO_VALUES, include_no_prio) + status_ids_url, columns_ids = get_ids(opener, baseurl, columns, + CHECK_STATUS_VALUES) + formated_search_url = SEARCH_ROUNDUP_STATUS.format( + priority_values=prio_ids_url, + keyword_values=keywords_ids_url, status_values=status_ids_url) - current_issues_csv = get_csv_from_server(opener, baseurl, formated_search_url) + current_issues_csv = get_csv_from_server(opener, baseurl, + 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 0d6504d02a6b -r 9aca070c86bd display_issues.py --- a/display_issues.py Thu Nov 22 14:07:55 2018 +0100 +++ b/display_issues.py Thu Nov 22 19:34:53 2018 +0100 @@ -40,7 +40,7 @@ return ", ".join(formated) -def get_webpage(data_dict, columns, status, keywords, graph=None): +def get_webpage(data_dict, columns, search_parameters, keywords, graph=None): if graph is None: graph = os.path.dirname(os.path.realpath(__file__)) + '/graph.html' @@ -58,14 +58,14 @@ js_data_dickt += "}" base_html_data = (base_html_data - .replace("status", status) + .replace("search_parameters", search_parameters) .replace("keywords", keywords) .replace("js_data_dickt", js_data_dickt) .replace("var timestamp=[];", "var timestamp=[" + make_js_object_date(data_dict["date"]) + "]")) return base_html_data -def compile_db_stats_html(db_file, sql_select, columns, status="", keywords="", graph=None): +def compile_db_stats_html(db_file, sql_select, columns, search_parameters="", keywords="", graph=None): data_dict = {"date": []} status_list = columns.split(", ") @@ -91,14 +91,14 @@ if con: con.close() - return get_webpage(data_dict, columns, status, keywords, graph) + return get_webpage(data_dict, columns, search_parameters, keywords, graph) def render_webpage(content): for line in content.split("\n"): print(line) -def render_db_stats_as_html(db_file, sql_select, columns, status="", keywords=""): - render_webpage(compile_db_stats_html(db_file, sql_select, columns, status, keywords)) +def render_db_stats_as_html(db_file, sql_select, columns, search_parameters="", keywords=""): + render_webpage(compile_db_stats_html(db_file, sql_select, columns, search_parameters, keywords)) if __name__ == '__main__': cgitb.enable() diff -r 0d6504d02a6b -r 9aca070c86bd graph.html --- a/graph.html Thu Nov 22 14:07:55 2018 +0100 +++ b/graph.html Thu Nov 22 19:34:53 2018 +0100 @@ -111,7 +111,7 @@

Filter

-

States: status

+

Search parameters: search_parameters

Keywords: keywords

diff -r 0d6504d02a6b -r 9aca070c86bd roundup_cc.py --- a/roundup_cc.py Thu Nov 22 14:07:55 2018 +0100 +++ b/roundup_cc.py Thu Nov 22 19:34:53 2018 +0100 @@ -36,19 +36,22 @@ database_file = config.get("DB", "DatabaseFile") keywords = config.get("SEARCH", "Keywords", fallback="").split(", ") + include_no_prio = config.getboolean("SEARCH", "IncludeNoPrio", fallback= False) search = config.get("SEARCH", "Search", fallback="prio") if search == "prio": list_of_columns = config.get("SEARCH", "Priority", fallback=PRIO).split(", ") - status = config.get("SEARCH", "Status", fallback="").split(", ") - include_no_prio = config.getboolean("SEARCH", "IncludeNoPrio", fallback= False) + search_parameters = config.get("SEARCH", "Status", fallback="").split(", ") if include_no_prio: list_of_columns += ["None"] elif search == "status": list_of_columns = config.get("SEARCH", "Status", fallback=STATES).split(", ") - status = [""] - include_no_prio = False + # statsu = columns Must change + search_parameters = config.get("SEARCH", "Priority", fallback="").split(", ") + if include_no_prio: + search_parameters += ["None"] + else: print("Incorrect [SEARCH]Search parameter. (prio, status)") @@ -63,7 +66,7 @@ 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, status, include_no_prio) + list_of_columns, create_db, insert_new, keywords, search_parameters, include_no_prio) if __name__ == '__main__': main() diff -r 0d6504d02a6b -r 9aca070c86bd roundup_cc_display.py --- a/roundup_cc_display.py Thu Nov 22 14:07:55 2018 +0100 +++ b/roundup_cc_display.py Thu Nov 22 19:34:53 2018 +0100 @@ -33,7 +33,7 @@ search = config.get("SEARCH", "Search", fallback="prio") if search == "prio": - status = config.get("SEARCH", "Status", fallback="") + search_parameters = config.get("SEARCH", "Status", fallback="") columns = config.get("SEARCH", "Priority", fallback=PRIO) noPrio = config.get("SEARCH", "IncludeNoPrio", fallback=False) if noPrio: @@ -41,7 +41,7 @@ elif search == "status": columns = config.get("SEARCH", "Status", fallback=STATES) - status = "" + search_parameters = config.get("SEARCH", "Priority", fallback="") else: print("Incorrect [SEARCH]Search parameter. (prio, status)") @@ -54,7 +54,7 @@ #render_db_stats_as_html("./demo1.db", rcd.SELECT_ALL) render_db_stats_as_html(db, rcd.build_sql_select(columns).format("timestamp > date('now', '-2 month')"), - columns, status, keywords) + columns, search_parameters, keywords) if __name__ == '__main__': main()