gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject cvs commit: jakarta-gump/python/gump/model project.py
Date Mon, 23 Feb 2004 16:22:44 GMT
ajack       2004/02/23 08:22:44

  Modified:    python/gump/model project.py
  Log:
  Rounding problem w/ percentages...
  
  Revision  Changes    Path
  1.53      +18 -12    jakarta-gump/python/gump/model/project.py
  
  Index: project.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/model/project.py,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- project.py	23 Feb 2004 15:43:06 -0000	1.52
  +++ project.py	23 Feb 2004 16:22:43 -0000	1.53
  @@ -1350,6 +1350,7 @@
           self.statepairs=statepairs
           
           # Percentages
  +        self.overallPercentage=0
           self.successesPercentage=0
           self.failuresPercentage=0
           self.prereqsPercentage=0
  @@ -1406,13 +1407,18 @@
           self.calculatePercentages()
           
       def calculatePercentages(self):
  -    
  +        """ Keep counters correct """
           if self.projects > 0:            
  -            self.successesPercentage=round((self.successes/self.projects)*100,2)
  -            self.failuresPercentage=round((self.failures/self.projects)*100,2)
  -            self.prereqsPercentage=round((self.prereqs/self.projects)*100,2)
  -            self.noworksPercentage=round((self.noworks/self.projects)*100,2)
  -            self.packagesPercentage=round((self.packages/self.projects)*100,2)
  -            self.othersPercentage=round((self.others/self.projects)*100,2)
  +            self.successesPercentage=round((float(self.successes)*100)/self.projects,2)
  +            self.failuresPercentage=round((float(self.failures)*100)/self.projects,2)
  +            self.prereqsPercentage=round((float(self.prereqs)*100)/self.projects,2)
  +            self.noworksPercentage=round((float(self.noworks)*100)/self.projects,2)
  +            self.packagesPercentage=round((float(self.packages)*100)/self.projects,2)
  +            self.othersPercentage=round((float(self.others)*100)/self.projects,2)
               
  -            self.overalPercentage=(round(((self.successes + self.packages)/self.projects)*100),2)
  +            # This is the overall success of a run...
  +            self.overallPercentage=(round((float(self.successes + self.packages)*100)/self.projects),2)
  +            
  +    def getOverallPercentage(self):
  +        """ Return the overall success """
  +        return self.overallPercentage
  
  
  

Mime
View raw message