Changeset 4911

Show
Ignore:
Timestamp:
12/01/08 09:58:42 (1 month ago)
Author:
optilude
Message:

Fix scaling and remove limitation to 100 tickets

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • estimationtoolsplugin/branches/optilude-change-line/estimationtools/burndownchart.py

    r4909 r4911  
    4646     
    4747    def render_macro(self, req, name, content): 
    48          
     48 
    4949        # prepare options 
    5050        options, query_args = parse_options(self.env.get_db_cnx(), content, copy.copy(DEFAULT_OPTIONS)) 
     
    8383         
    8484        # 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) 
    90102        chart_params['chd'] = "t:%s|%s" % (",".join(xdata), ",".join(ydata),) 
    91103        cxdata = cydata = None 
    92104        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) 
    94106            chart_params['chd'] += "|%s|%s" % (",".join(cxdata), ",".join(cydata),) 
    95107         
     
    101113            "|1:|%s|%s" % (dates[0].month, dates[ - 1].month) + \ 
    102114            "|2:|%s|%s" % (dates[0].year, dates[ - 1].year) 
    103         chart_params['chxr'] = "3,0,%s" % maxhours 
     115        chart_params['chxr'] = "3,0,%d" % real_maxhours 
    104116         
    105117        # Add weekends 
     
    142154            query_args[initial_estimation_field + "!"] = None 
    143155        query_args['status' + "!"] = None 
    144          
     156 
    145157        tickets = execute_query(self.env, req, query_args) 
    146158 
     
    270282        # create sorted list of dates 
    271283         
    272         if maxhours <= Decimal(0): 
    273             maxhours = Decimal(100) 
    274284        ydata = [str(self._round(timetable[d] * Decimal(100) / maxhours)) 
    275285                 for d in dates] 
     
    282292            ydata = ydata[: - remaining_days] + ['-1' for x in xrange(0, remaining_days)] 
    283293         
    284         return xdata, ydata, maxhours 
     294        return xdata, ydata 
    285295     
    286296    def _mark_downtime(self, options, dates, xdata, ydata): 
  • estimationtoolsplugin/branches/optilude-change-line/estimationtools/utils.py

    r4909 r4911  
    9090    query_string = '&'.join(['%s=%s' % item for item in query_args.iteritems()]) 
    9191    query = Query.from_string(env, query_string) 
     92     
     93    # oooh, nasty 
     94    import sys 
     95    query.max = sys.maxint 
     96 
    9297 
    9398    tickets = query.execute(req)