From 708f380fc38b072c86bd451b8dff118d85688266 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Fri, 24 Jun 2016 17:38:08 +0200 Subject: [PATCH] SONAR-7719 remove version now remove it from snapshot --- .../webapp/WEB-INF/app/controllers/project_controller.rb | 2 +- .../src/main/webapp/WEB-INF/app/models/snapshot.rb | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/project_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/project_controller.rb index 6a8028e977f..9215bbe1934 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/project_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/project_controller.rb @@ -322,7 +322,7 @@ class ProjectController < ApplicationController access_denied unless is_admin?(parent_snapshot) # We update all the related snapshots to have the same version as the next snapshot - next_snapshot = Snapshot.find(:first, :conditions => ['created_at>? and component_uuid=?', parent_snapshot.created_at.to_i*1000, parent_snapshot.component_uuid], :order => 'created_at asc') + next_snapshot = Snapshot.find(:first, :conditions => ['created_at>? and component_uuid=?', parent_snapshot.created_at_long, parent_snapshot.component_uuid], :order => 'created_at asc') parent_snapshot.version = next_snapshot.version parent_snapshot.save! diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/snapshot.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/snapshot.rb index 879ed2c648b..5bdfd72f561 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/snapshot.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/snapshot.rb @@ -37,7 +37,11 @@ class Snapshot < ActiveRecord::Base def created_at long_to_date(:created_at) end - + + def created_at_long + read_attribute(:created_at) + end + def build_date long_to_date(:build_date) end -- 2.39.5