diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index a457c45f3..0833c9dc0 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -63,7 +63,7 @@ class ProjectsController < ApplicationController :pl_id => auto_build_list.pl_id, :bpl_id => auto_build_list.bpl_id, :arch_id => auto_build_list.arch_id, - :project_version => project.project_versions.last.try(:name), + :project_version => project.collected_project_versions.last.try(:first), :build_requires => true, :update_type => 'bugfix') if auto_build_list @@ -74,7 +74,7 @@ class ProjectsController < ApplicationController @arches = Arch.recent @bpls = Platform.main @pls = @project.repositories.collect { |rep| ["#{rep.platform.name}/#{rep.unixname}", rep.platform.id] } - @project_versions = @project.project_versions.collect { |tag| [tag.name, tag.name.gsub(/^\w+\./, "")] } + @project_versions = @project.collected_project_versions end def process_build @@ -90,7 +90,7 @@ class ProjectsController < ApplicationController update_type = params[:build][:update_type] build_requires = params[:build][:build_requires] - @project_versions = @project.project_versions.collect { |tag| [tag.name, tag.name.gsub(/^\w+\./, "")] }.select { |pv| pv[0] =~ /^v\./ } + @project_versions = @project.collected_project_versions if !check_arches || !check_project_versions @arches = Arch.recent diff --git a/app/models/project.rb b/app/models/project.rb index 7dece9c00..3d3b95739 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -39,9 +39,12 @@ class Project < ActiveRecord::Base after_rollback lambda { destroy_git_repo rescue true if new_record? } def project_versions - #tags.collect { |tag| [tag.name, tag.name.gsub(/^\w+\./, "")] }.select { |pv| pv[0] =~ /^v\./ } tags.select { |tag| tag.name =~ /^v\./ } end + + def collected_project_versions + project_versions.collect { |tag| new_tag = tag.name.gsub(/^\w+\./, ""); [new_tag, new_tag] } + end def tags self.git_repository.tags