Changeset 4911
- Timestamp:
- 12/01/08 09:58:42 (1 month ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
estimationtoolsplugin/branches/optilude-change-line/estimationtools/burndownchart.py
r4909 r4911 46 46 47 47 def render_macro(self, req, name, content): 48 48 49 49 # prepare options 50 50 options, query_args = parse_options(self.env.get_db_cnx(), content, copy.copy(DEFAULT_OPTIONS)) … … 83 83 84 84 # Add scaled data 85 maxhours = max(timetable.values()) 86 if change: 87 maxhours = max(maxhours, max(timetable_less_change.values())) 88 89 xdata, ydata,maxhours = self._scale_data(timetable, dates, maxhours, options) 85 try: 86 maxhours = max(timetable.values()) 87 except ValueError: 88 maxhours = 0 89 90 try: 91 cmaxhours = max(timetable_less_change.values()) 92 except ValueError: 93 cmaxhours = 0 94 95 96 real_maxhours = max(maxhours, cmaxhours) 97 real_maxhours = Decimal(real_maxhours) 98 if real_maxhours <= Decimal(0): 99 real_maxhours = Decimal(100) 100 101 xdata, ydata = self._scale_data(timetable, dates, real_maxhours, options) 90 102 chart_params['chd'] = "t:%s|%s" % (",".join(xdata), ",".join(ydata),) 91 103 cxdata = cydata = None 92 104 if change: 93 cxdata, cydata ,maxhours = self._scale_data(timetable_less_change, dates,maxhours, options)105 cxdata, cydata = self._scale_data(timetable_less_change, dates, real_maxhours, options) 94 106 chart_params['chd'] += "|%s|%s" % (",".join(cxdata), ",".join(cydata),) 95 107 … … 101 113 "|1:|%s|%s" % (dates[0].month, dates[ - 1].month) + \ 102 114 "|2:|%s|%s" % (dates[0].year, dates[ - 1].year) 103 chart_params['chxr'] = "3,0,% s" %maxhours115 chart_params['chxr'] = "3,0,%d" % real_maxhours 104 116 105 117 # Add weekends … … 142 154 query_args[initial_estimation_field + "!"] = None 143 155 query_args['status' + "!"] = None 144 156 145 157 tickets = execute_query(self.env, req, query_args) 146 158 … … 270 282 # create sorted list of dates 271 283 272 if maxhours <= Decimal(0):273 maxhours = Decimal(100)274 284 ydata = [str(self._round(timetable[d] * Decimal(100) / maxhours)) 275 285 for d in dates] … … 282 292 ydata = ydata[: - remaining_days] + ['-1' for x in xrange(0, remaining_days)] 283 293 284 return xdata, ydata , maxhours294 return xdata, ydata 285 295 286 296 def _mark_downtime(self, options, dates, xdata, ydata): estimationtoolsplugin/branches/optilude-change-line/estimationtools/utils.py
r4909 r4911 90 90 query_string = '&'.join(['%s=%s' % item for item in query_args.iteritems()]) 91 91 query = Query.from_string(env, query_string) 92 93 # oooh, nasty 94 import sys 95 query.max = sys.maxint 96 92 97 93 98 tickets = query.execute(req)
