# - - - P a r t y H o u r s R o w . _ s u m E f f o r t s def _sumEfforts(self): '''Return all column efforts as a list of LabelCell instances [ return a list of PartyHoursCell instances, one per logical column, where each instance displays the total number of party-hours from the self.db.Effort table for that column ] '''
We start with the list of effort keys from
self.cbcHist.effKeyList. For each such key, we
determine which logical column it belongs to, and add it to a
list of float values.
#-- 1 # [ cellList := a list containing self.cbcHist.nCols # PartyHoursCell instances ] cellList = [ PartyHoursCell() for k in range(self.cbcHist.nCols) ]
Only positive values are added to each cell. This is important so that zero or negative party-hours values from the database are not used for statistical calculations.
#-- 2 # [ cellList := cellList with party-hours added from # self.cbcHist.db's Effort instances for effort keys # in self.cbcHist.effKeyList ] for effKey in self.cbcHist.effKeyList: effort = self.cbcHist.db.getEffort(effKey.year_no, effKey.year_key) value = float(effort.ph_tot) colx = self.cbcHist.findColumn(effKey) if value > 0.0: cellList[colx].add(value) #-- 3 return cellList