/[papo]/gnue/reports/src/GRDataMapper.py
ViewVC logotype

Diff of /gnue/reports/src/GRDataMapper.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by charlie, Fri Jun 28 19:43:54 2002 UTC revision 1.2 by styxman, Thu Nov 14 23:02:37 2002 UTC
# Line 61  class GRDataMapperSection: Line 61  class GRDataMapperSection:
61      self.datasource = None      self.datasource = None
62      self._resultsets = []      self._resultsets = []
63    
64        self._clearOnNextSet = 0
65    
66      self._summMap = {'sum': self._summ_sum,      self._summMap = {'sum': self._summ_sum,
67                       'count': self._summ_count,                       'count': self._summ_count,
68                       'avg': self._summ_avg,                       'avg': self._summ_avg,
# Line 138  class GRDataMapperSection: Line 140  class GRDataMapperSection:
140    #    #
141    # Zero out the summary data    # Zero out the summary data
142    #    #
143    def _clearSummaries(self):    def clearSummaries(self):
144      for field in self.summaries.keys():      for field in self.summaries.keys():
145        for function in self.summaries[field].keys():        for function in self.summaries[field].keys():
146          self.summaries[field][function] = None          self.summaries[field][function] = None
147        self._clearOnNextSet = 0
148    
149    
150    #    #
# Line 166  class GRDataMapperSection: Line 169  class GRDataMapperSection:
169    #    #
170    # Initiate the calculation of summaries    # Initiate the calculation of summaries
171    #    #
172      # TODO: I **SERIOUSLY** don't think this is being used any longer
173    def _handleSummary(self):    def _handleSummary(self):
174        if self._clearOnNextSet:
175          self.clearSummaries()
176      # Now, calc all summaries      # Now, calc all summaries
177      for field in self.summaries.keys():      for field in self.summaries.keys():
178        for function in _summFunctions:        for function in _summFunctions:
# Line 183  class GRDataMapperSection: Line 189  class GRDataMapperSection:
189    #  the master-detail must be linked, the GRDataMapper will not have been    #  the master-detail must be linked, the GRDataMapper will not have been
190    #  created yet.  [Yes, it's fugly]    #  created yet.  [Yes, it's fugly]
191    def _masterChanged(self, masterResultSet, detailResultSet):    def _masterChanged(self, masterResultSet, detailResultSet):
192      GDebug.printMesg (5, 'GRDataMapper._masterChanged')      GDebug.printMesg (5, 'GRDataMapper._masterChanged on %s' % self.name)
193      self._resultsets.insert(0,detailResultSet)      self._resultsets.insert(0,detailResultSet)
194    
195    
# Line 358  class GRDataMapper(GRDataMapperSection): Line 364  class GRDataMapper(GRDataMapperSection):
364        for s in self.sourceMap[source]:        for s in self.sourceMap[source]:
365    
366          # Reset running summary counts if necessary...          # Reset running summary counts if necessary...
         if firstSection and firstSection != controlSection._lastSection:  
           s._clearSummaries()  
367    
368          changed = s._precheckNextFields(recordset)          changed = s._precheckNextFields(recordset)
369    
# Line 368  class GRDataMapper(GRDataMapperSection): Line 372  class GRDataMapper(GRDataMapperSection):
372            GDebug.printMesg(10, "After next record, first changed section is %s" % s.name)            GDebug.printMesg(10, "After next record, first changed section is %s" % s.name)
373            firstSection = s.name            firstSection = s.name
374    
375    
376          # Save the new field values in the data handler          # Save the new field values in the data handler
377          for field in s.fields.keys():          for field in s.fields.keys():
378            s.fields[field] = recordset.getField(field)            s.fields[field] = recordset.getField(field)
379    
380          # ... and save any new summary data          # ... and save any new summary data
381            if s._clearOnNextSet:
382              s.clearSummaries()
383    
384          for field in s.summaries.keys():          for field in s.summaries.keys():
385            for function in _summFunctions:            for function in _summFunctions:
386              if s.summaries[field].has_key(function):              if s.summaries[field].has_key(function):
# Line 402  _summFunctions = ('count','sum','min','m Line 410  _summFunctions = ('count','sum','min','m
410  # Contains all "summary" functions that  # Contains all "summary" functions that
411  # depend on other record keeping. (e.g.,  # depend on other record keeping. (e.g.,
412  # 'averages' need the total and the count  # 'averages' need the total and the count
413  # tracked.  # tracked.)
414  #  #
415  _summMultiMapping = { 'avg': ('sum','count'),  _summMultiMapping = { 'avg': ('sum','count'),
416                      }                      }

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26