Changeset 390

Show
Ignore:
Timestamp:
Mon Apr 28 16:24:30 2008
Author:
Brian
Message:

Alex provided a better algorithm for allocating effort hours

Files:

Legend:

Unmodified
Added
Removed
Modified
  • scripts/trunk/Track Resource Hours/Calculate Assignment Hours.py

    r353 r390  
    24 24 #               show hint message if require tables not available  
    25 25 # 050601 - Brian - Test for existence of resources in "Resource" table, not "Report" table  
      26 # 080428 - Alex - better algorithm for allocating effort hours  
    26 27  
    27 28 # It uses the following fields:  
     
    173 174         maxdays = 100  
    174 175         cnt = 0  
      176         realhours = discretehours = 0  
    175 177         while hours > 0:  
    176 178             cnt += 1  
     
    179 181             dh, cum, dow = Data.DateInfo[dateindex]  
    180 182             newhours = dh * multiplier  
    181               if newhours > 0 and newhours < 1:  # should I allow fractional planned hours?  
    182                  newhours = 1  
    183               else:  
    184                  newhours = int(round(newhours))  
      183             if 0 < newhours < 1:  
      184                 newhours = 1  
      185  
      186             realhours += newhours  
      187             newhours = int(realhours) - discretehours  
      188             if realhours % 1: newhours += 1  # takes fractional hours earlier  
      189 ##            newhours = int(round(realhours)) - discretehours  
      190             discretehours += newhours  
      191              
    185 192             if newhours > hours:  
    186 193                 newhours = hours