diff collect_issues.py @ 32:80bbd06fe8ec

Add Comments
author Magnus Schieder <mschieder@intevation.de>
date Fri, 23 Nov 2018 16:13:24 +0100
parents 9aca070c86bd
children 946b9f458fcc
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)
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)