aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-05 13:42:24 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-05 13:42:32 +0100
commit3a7b42c239627e016d2272311b98759ede7894e6 (patch)
tree8b46f30959be71009bc45c2d0a57ba7cb788b61b
parent87c19792e37eb476606931884fb56df842120d4f (diff)
downloadsonarqube-3a7b42c239627e016d2272311b98759ede7894e6.tar.gz
sonarqube-3a7b42c239627e016d2272311b98759ede7894e6.zip
Fix quality flaws
-rw-r--r--sonar-core/src/main/java/org/sonar/core/i18n/WorkDurationFormatter.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/i18n/WorkDurationFormatter.java b/sonar-core/src/main/java/org/sonar/core/i18n/WorkDurationFormatter.java
index 93d652c2757..f760bf44802 100644
--- a/sonar-core/src/main/java/org/sonar/core/i18n/WorkDurationFormatter.java
+++ b/sonar-core/src/main/java/org/sonar/core/i18n/WorkDurationFormatter.java
@@ -56,17 +56,25 @@ public class WorkDurationFormatter implements ServerComponent, BatchExtension {
if (workDuration.days() > 0) {
results.add(message("work_duration.x_days", isNegative ? -1 * workDuration.days() : workDuration.days()));
}
- if (workDuration.hours() > 0 && workDuration.days() < 10) {
+ if (displayHours(workDuration)) {
addSpaceIfNeeded(results);
results.add(message("work_duration.x_hours", isNegative && results.isEmpty() ? -1 * workDuration.hours() : workDuration.hours()));
}
- if (workDuration.minutes() > 0 && workDuration.hours() < 10 && workDuration.days() == 0) {
+ if (displayMinutes(workDuration)) {
addSpaceIfNeeded(results);
results.add(message("work_duration.x_minutes", isNegative && results.isEmpty() ? -1 * workDuration.minutes() : workDuration.minutes()));
}
return results;
}
+ private boolean displayHours(WorkDuration workDuration){
+ return workDuration.hours() > 0 && workDuration.days() < 10;
+ }
+
+ private boolean displayMinutes(WorkDuration workDuration){
+ return workDuration.minutes() > 0 && workDuration.hours() < 10 && workDuration.days() == 0;
+ }
+
private void addSpaceIfNeeded(List<Result> results){
if (!results.isEmpty()) {
results.add(new Result(" ", null));