]> source.dussan.org Git - sonarqube.git/commitdiff
Fix display of debt in /api/issues/show
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 18 Jun 2014 08:29:30 +0000 (10:29 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 18 Jun 2014 08:29:30 +0000 (10:29 +0200)
sonar-server/src/main/java/org/sonar/server/issue/ws/IssueShowAction.java
sonar-server/src/main/resources/org/sonar/server/issue/ws/example-show.json
sonar-server/src/test/java/org/sonar/server/issue/ws/IssueShowActionTest.java
sonar-server/src/test/resources/org/sonar/server/issue/ws/IssueShowActionTest/show_issue_with_technical_debt.json

index ed3d279b158285f4d6f4fe20031e3e901a2b4e99..8ee532f928a5638e37819e57a0415b03ea85c3fa 100644 (file)
@@ -127,7 +127,7 @@ public class IssueShowAction implements RequestHandler {
       .prop("author", issue.authorLogin())
       .prop("actionPlan", actionPlanKey)
       .prop("actionPlanName", actionPlan != null ? actionPlan.name() : null)
-      .prop("debt", debt != null ? durations.format(UserSession.get().locale(), debt, Durations.DurationFormat.SHORT) : null)
+      .prop("debt", debt != null ? durations.encode(debt) : null)
       .prop("creationDate", DateUtils.formatDateTime(issue.creationDate()))
       .prop("fCreationDate", formatDate(issue.creationDate()))
       .prop("updateDate", updateDate != null ? DateUtils.formatDateTime(updateDate) : null)
index 4173dca031471c94d81c895260e96a98760dd51f..f0a4edc287c355ed4ac96419dc56643e0becbae7 100644 (file)
@@ -8,7 +8,7 @@
     "status": "OPEN",
     "severity": "MAJOR",
     "author": "Developer 1",
-    "debt": "2 minutes",
+    "debt": "2min",
     "creationDate": "2014-02-14T23:04:29+0100",
     "fCreationDate": "Feb 14, 2014 11:04 PM",
     "updateDate": "2014-03-04T23:03:44+0100",
index 35a83cb0ce763155236c9fa3208504236e2005b3..57ff3ea82a4677ca1d7f860f8621330f5513dda4 100644 (file)
@@ -310,7 +310,7 @@ public class IssueShowActionTest {
     Issue issue = createStandardIssue().setDebt(debt);
     issues.add(issue);
 
-    when(durations.format(any(Locale.class), eq(debt), eq(Durations.DurationFormat.SHORT))).thenReturn("2 hours 1 minutes");
+    when(durations.encode(debt)).thenReturn("2h1min");
 
     MockUserSession.set();
     WsTester.TestRequest request = tester.newGetRequest("api/issues", "show").setParam("key", issue.key());
index d7cbcc874282f45f7b7134b03b5e808c55eb2c2b..4a42e205d756ac5bc8f215c59790e91ec7566967 100644 (file)
@@ -8,7 +8,7 @@
     "projectName": "SonarQube",
     "rule": "squid:AvoidCycle",
     "ruleName": "Avoid cycle",
-    "debt": "2 hours 1 minutes",
+    "debt": "2h1min",
     "creationDate": "2014-01-22T19:10:03+0100",
     "fCreationDate": "Jan 22, 2014 10:03 AM",
     "transitions": [],