From: Julien Lancelot Date: Tue, 16 Apr 2013 12:51:29 +0000 (+0200) Subject: SONAR-3755 Fix issue in duration displayed in issues code viewer X-Git-Tag: 3.6~683 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e4e691565a645095c089a8268b12329b9433bdb4;p=sonarqube.git SONAR-3755 Fix issue in duration displayed in issues code viewer --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb index 9e047fd4487..1a162aa4550 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/api/issues_controller.rb @@ -53,13 +53,13 @@ class Api::IssuesController < Api::ApiController json[:resolution] = issue.resolution if issue.resolution json[:userLogin] = issue.userLogin if issue.userLogin json[:assigneeLogin] = issue.assigneeLogin if issue.assigneeLogin - json[:createdAt] = to_date(issue.createdAt) if issue.createdAt - json[:updatedAt] = to_date(issue.updatedAt) if issue.updatedAt - json[:closedAt] = to_date(issue.closedAt) if issue.closedAt + json[:createdAt] = format_java_datetime(issue.createdAt) if issue.createdAt + json[:updatedAt] = format_java_datetime(issue.updatedAt) if issue.updatedAt + json[:closedAt] = format_java_datetime(issue.closedAt) if issue.closedAt json end - def to_date(java_date) + def format_java_datetime(java_date) java_date ? Api::Utils.format_datetime(Time.at(java_date.time/1000)) : nil end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb index c0b0c1dfc80..b8c0c03aa88 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/resource_helper.rb @@ -44,7 +44,7 @@ module ResourceHelper end def to_date(java_date) - java_date ? Api::Utils.format_datetime(Time.at(java_date.time/1000)) : nil + java_date ? Time.at(java_date.time/1000) : nil end end \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_issue.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_issue.html.erb index 33ad50c0861..06c77ca2f7a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_issue.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/resource/_issue.html.erb @@ -22,6 +22,8 @@   <% if issue.created_at %> + <% puts "### " + Time.now.to_s %> + <% puts "### " + Time.now.to_s %> <%= distance_of_time_in_words_to_now(to_date(issue.created_at)) -%>   <% end %>