continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r571163 - /maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java
Date Thu, 30 Aug 2007 13:27:11 GMT
Author: evenisse
Date: Thu Aug 30 06:27:10 2007
New Revision: 571163

URL: http://svn.apache.org/viewvc?rev=571163&view=rev
Log:
Fix status counters

Modified:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java

Modified: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java?rev=571163&r1=571162&r2=571163&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/SummaryAction.java
Thu Aug 30 06:27:10 2007
@@ -19,12 +19,6 @@
  * under the License.
  */
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
@@ -33,6 +27,12 @@
 import org.apache.maven.continuum.web.model.GroupSummary;
 import org.apache.maven.continuum.web.model.ProjectSummary;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 /**
  * Used to render the list of projects in the project group page.
  *
@@ -48,7 +48,7 @@
     private String projectGroupName;
 
     private List summary;
-    
+
     private GroupSummary groupSummary = new GroupSummary();
 
     public String execute()
@@ -75,10 +75,17 @@
 
         summary = new ArrayList();
 
+        groupSummary.setNumErrors( 0 );
+        groupSummary.setNumFailures( 0 );
+        groupSummary.setNumSuccesses( 0 );
+        groupSummary.setNumProjects( 0 );
+
         for ( Iterator i = projectsInGroup.iterator(); i.hasNext(); )
         {
             Project project = (Project) i.next();
 
+            groupSummary.setNumProjects( groupSummary.getNumProjects() + 1 );
+
             ProjectSummary model = new ProjectSummary();
 
             model.setId( project.getId() );
@@ -135,59 +142,34 @@
 
         return SUCCESS;
     }
-    
-    private void populateGroupSummary(BuildResult latestBuild)
+
+    private void populateGroupSummary( BuildResult latestBuild )
     {
         switch ( latestBuild.getState() )
         {
             case ContinuumProjectState.ERROR:
-                // default value -1 so +2 first time
-                if ( groupSummary.getNumErrors() < 0 )
-                {
-                    groupSummary.setNumErrors( groupSummary.getNumErrors() + 2 );
-                }
-                else
-                {
-                    groupSummary.setNumErrors( groupSummary.getNumErrors() + 1 );
-                }
+                groupSummary.setNumErrors( groupSummary.getNumErrors() + 1 );
                 break;
             case ContinuumProjectState.OK:
-                // default value -1 so +2 first time
-                if ( groupSummary.getNumSuccesses() < 0 )
-                {
-                    groupSummary.setNumSuccesses( groupSummary.getNumSuccesses() + 2 );
-                }
-                else
-                {
-                    groupSummary.setNumSuccesses( groupSummary.getNumSuccesses() + 1 );
-                }
+                groupSummary.setNumSuccesses( groupSummary.getNumSuccesses() + 1 );
                 break;
             case ContinuumProjectState.FAILED:
-                // default value -1 so +2 first time
-                if ( groupSummary.getNumFailures() < 0 )
-                {
-                    groupSummary.setNumFailures( groupSummary.getNumFailures() + 2 );
-                }
-                else
-                {
-                    groupSummary.setNumFailures( groupSummary.getNumFailures() + 1 );
-                }
+                groupSummary.setNumFailures( groupSummary.getNumFailures() + 1 );
                 break;
             default:
                 getLogger().warn(
-                                  "unknown buildState value " + latestBuild.getState() +
" with build "
-                                      + latestBuild.getId() );
+                    "unknown buildState value " + latestBuild.getState() + " with build "
+ latestBuild.getId() );
         }
         // to not display -1
-        if (groupSummary.getNumFailures() < 0)
+        if ( groupSummary.getNumFailures() < 0 )
         {
             groupSummary.setNumFailures( 0 );
         }
-        if (groupSummary.getNumErrors() < 0 )
+        if ( groupSummary.getNumErrors() < 0 )
         {
             groupSummary.setNumErrors( 0 );
         }
-        if (groupSummary.getNumSuccesses() < 0 )
+        if ( groupSummary.getNumSuccesses() < 0 )
         {
             groupSummary.setNumSuccesses( 0 );
         }



Mime
View raw message