changeset 32:80bbd06fe8ec

Add Comments
author Magnus Schieder <mschieder@intevation.de>
date Fri, 23 Nov 2018 16:13:24 +0100
parents 9aca070c86bd
children 946b9f458fcc
files collect_issues.py display_issues.py roundup_cc.py roundup_cc_display.py
diffstat 4 files changed, 22 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- 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 <sascha.teichmann@intevation.de>
 author: Bernhard Reiter <bernhard@intevation.de>
 author: Sean Engelhardt <sean.engelhardt@intevation.de>
-
+author: Magnus Schieder <magnus.schieder@intevation.de>
 (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)
 
--- 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 <sascha.teichmann@intevation.de>
 author: Bernhard Reiter <bernhard@intevation.de>
 author: Sean Engelhardt <sean.engelhardt@intevation.de>
-
-(c) 2010,2015 by Intevation GmbH
+author: Magnus Schieder <magnus.schieder@intevation.de>
+(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]) + "],"
--- 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()
--- 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 <sascha.teichmann@intevation.de>
 author: Bernhard Reiter <bernhard@intevation.de>
 author: Sean Engelhardt <sean.engelhardt@intevation.de>
+author: Magnus Schieder <magnus.schieder@intevation.de>
 
 (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="")
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)