aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-batch/src
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-05 16:55:30 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2014-03-05 18:46:30 +0100
commit221d3c443d45f024b292cdbe6c0558fcf18f055c (patch)
treef50d071ad4912bfddf9778434f92596a68de28ed /sonar-batch/src
parent5db887d91de4e330ac6370a90251050f8ec93517 (diff)
downloadsonarqube-221d3c443d45f024b292cdbe6c0558fcf18f055c.tar.gz
sonarqube-221d3c443d45f024b292cdbe6c0558fcf18f055c.zip
SONAR-5056 Create Duration API
Diffstat (limited to 'sonar-batch/src')
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/debt/RuleDebtCalculator.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/debt/RuleDebtCalculator.java b/sonar-batch/src/main/java/org/sonar/batch/debt/RuleDebtCalculator.java
index 2352e791984..54798761191 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/debt/RuleDebtCalculator.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/debt/RuleDebtCalculator.java
@@ -38,11 +38,11 @@ import javax.annotation.Nullable;
public class RuleDebtCalculator implements BatchExtension {
private final TechnicalDebtModel model;
- private final int hoursInDay;
+ private final Settings settings;
public RuleDebtCalculator(TechnicalDebtModel model, Settings settings) {
this.model = model;
- this.hoursInDay = settings.getInt(CoreProperties.HOURS_IN_DAY);
+ this.settings = settings;
}
/**
@@ -79,7 +79,7 @@ public class RuleDebtCalculator implements BatchExtension {
private long convertValueAndUnitToMinutes(int value, WorkDuration.UNIT unit){
if (WorkDuration.UNIT.DAYS.equals(unit)) {
- return 60L * value * hoursInDay;
+ return 60L * value * hoursInDay();
} else if (WorkDuration.UNIT.HOURS.equals(unit)) {
return 60L * value;
} else if (WorkDuration.UNIT.MINUTES.equals(unit)) {
@@ -88,4 +88,8 @@ public class RuleDebtCalculator implements BatchExtension {
throw new IllegalStateException("Invalid unit : " + unit);
}
+ private int hoursInDay(){
+ return settings.getInt(CoreProperties.HOURS_IN_DAY);
+ }
+
}