Skip to content
Permalink
Browse files

Revert "[JENKINS-37329] - Changed caluclation of RoundDecimal again."

This reverts commit f22fe98.
  • Loading branch information
opx3 committed Aug 20, 2016
1 parent b4486c4 commit 8ace1d0873af1ae523ebc25d7c269bd7ba048de8
@@ -23,6 +23,7 @@
private int totalUnstable;
private int totalNobuild;
private int totalBuilds;
private String space;

public StatsFactory(){
this.stats = new Hashtable<String, StatsModel>();
@@ -32,6 +33,7 @@ public StatsFactory(){
this.totalUnstable = 0;
this.totalNobuild = 0;
this.totalBuilds = 0;
this.space="&nbsp;";
}

public static StatsFactory generateStats(List<JobBuildSearchResult> searchResults){
@@ -166,4 +168,10 @@ public int getTotalBuilds(){
public double getFailureRate(){
return StatsMath.getPercent(this.totalBuilds - this.totalSuccess, this.totalBuilds);
}

@Exported
public String getPaddedFailureRate(){
return String.format("%12.2f", this.getFailureRate()).replace(" ", this.space);
}

}
@@ -11,8 +11,8 @@ public static double getPercent(double subVal, double totalVal){
}

public static double roundTwoDecimals(double iVal){
DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(Locale.getDefault());
DecimalFormat twoDForm = new DecimalFormat("#"+decimalFormatSymbols.getDecimalSeparator()+"##",decimalFormatSymbols);
DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(Locale.ENGLISH);
DecimalFormat twoDForm = new DecimalFormat("#.00",decimalFormatSymbols);
return Double.valueOf(twoDForm.format(iVal));
}
}
@@ -11,7 +11,8 @@
private int aborts;
private int unstables;
private int nobuilds;
private int totalBuilds;
private int totalBuilds;
private String space;

public StatsModel(String jobName){
this.jobName = jobName;
@@ -21,6 +22,7 @@ public StatsModel(String jobName){
this.unstables = 0;
this.nobuilds = 0;
this.totalBuilds = 0;
this.space="&nbsp;";
}

public String getJobName(){
@@ -86,6 +88,11 @@ public int getTotalBuilds(){
public double getFailureRate(){
return StatsMath.getPercent(this.totalBuilds - this.successes, this.totalBuilds);
}

@Exported
public String getPaddedFailureRate(){
return String.format("%12.2f", this.getFailureRate()).replace(" ", this.space);
}

public int compareTo(Object o){
if(o instanceof StatsModel) return compareTo((StatsModel)o);
@@ -40,7 +40,7 @@
<td class="pane">${stat.aborts}</td>
<td class="pane">${stat.noBuilds}</td>
<td class="pane">${stat.totalBuilds}</td>
<td class="pane">${stat.failureRate}%</td>
<td class="pane">${stat.paddedFailureRate}%</td>
</tr>
</j:forEach>
<tr>
@@ -51,7 +51,7 @@
<th class="pane" style="font-weight:bold;">${buildStats.aborts}</th>
<th class="pane" style="font-weight:bold;">${buildStats.noBuilds}</th>
<th class="pane" style="font-weight:bold;">${buildStats.totalBuilds}</th>
<th class="pane" style="font-weight:bold;">${buildStats.failureRate}%</th>
<th class="pane" style="font-weight:bold;">${buildStats.paddedFailureRate}%</th>
</tr>
</table>
</j:otherwise>

0 comments on commit 8ace1d0

Please sign in to comment.
You can’t perform that action at this time.