diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index a137b7cd1..c6cb018a5 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -102,6 +102,7 @@ class IssuesController < ApplicationController @issue_count = @query.issue_count @test = params[:test] @project_sort = 'issues.updated_on desc' + if params[:test] != "0" case @test when "1" @@ -284,11 +285,11 @@ class IssuesController < ApplicationController # 用户编辑更改issue def update - # params[:assigned_to_id] = nil if params[:assigned_to_id].to_i == 0 + # params[:assigned_to_id] = nil if params[:assigned_to_id].to_i == 0 + # params[:fixed_version_id] = nil if params[:fixed_version_id].to_i == 0 if params[:issue_detail] issue = Issue.find(params[:id]) issue = update_user_issue_detail(issue, params) - @issue.assigned_to_id = nil if @issue.assigned_to_id == 0 @saved = update_user_issue_detail(issue, params) return else @@ -296,6 +297,7 @@ class IssuesController < ApplicationController return unless update_issue_from_params @issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads])) @issue.assigned_to_id = nil if @issue.assigned_to_id == 0 + @issue.fixed_version_id = nil if @issue.fixed_version_id == 0 saved = false begin @saved = @issue.save_issue_with_child_records(params, @time_entry) @@ -630,7 +632,9 @@ class IssuesController < ApplicationController end end # 搜索结果 - @issues_filter = @query.issues(:order => @project_sort) + # SELECT assigned_to_id, count(*) as ac FROM `issues` where project_id = @project.id group by assigned_to_id order by ac desc; + @issues_filter = @query.issues.sort_by{ |i| Issue.where(:project_id => @project.id , :assigned_to_id => i.assigned_to_id).count }.reverse + # @issues_filter = @query.issues(:order => @project_sort) # if params[:type] == 1 || params[:type].nil? # @results = @issues_filter @@ -668,7 +672,7 @@ class IssuesController < ApplicationController @alltotal[issue.tracker_id.to_i] = @alltotal[issue.tracker_id.to_i] + 1 user_id = issue.assigned_to_id if issue.assigned_to_id.nil? - user_id = issue.author_id + user_id = 0 end if !@results[user_id].nil? @@ -696,7 +700,7 @@ class IssuesController < ApplicationController tmpuser = User.find(user_id) - @results[user_id][:name] = tmpuser.nil? ? " " : tmpuser.show_name + @results[user_id][:name] = tmpuser.nil? ? "" : tmpuser.show_name #所有的 @results[user_id][0] = 1 for i in 1..17 do diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index e481b09a6..ec9f98ccf 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -95,7 +95,7 @@ class PullRequestsController < ApplicationController if params[:target_project_id] target_project_id = params[:forked_project_id].to_i request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch, :target_project_id => target_project_id) - @fork_project_name = Project.find(target_project_id).try(:name) + @fork_project_name = Project.find(params[:target_project_id]).try(:name) @fork_pr_message = true if @fork_project_name else request = @g.create_merge_request(@project.gpid, title, User.current.gid, :description => description, :source_branch => source_branch, :target_branch => target_branch) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index fb757665f..653afef62 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -267,6 +267,16 @@ module ProjectsHelper project_name = versions.blank? ? "" : versions.first.project.name grouped = Hash.new {|h,k| h[k] = []} grouped[project_name] << ["请选择里程碑", 0] + +=begin + unless selected.nil? + if (params[:action] == "show" ) && Version.find(selected.id).status == "closed" + version_name = Version.find(selected.id).name + grouped[project_name] << [version_name, selected.id] + end + end +=end + versions.each do |version| grouped[version.project.name] << [version.name, version.id] end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 228e83080..4dd3399a3 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -100,7 +100,7 @@ module UsersHelper def applied_project_users applied_message # case applied_message.status # when 3,2,1,5,4,7,6 - user = User.find(applied_message.applied_user_id) + user = User.find(applied_message.applied_user_id).show_name # end end diff --git a/app/models/issue.rb b/app/models/issue.rb index 1b47d80cc..46a42cb34 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -854,7 +854,8 @@ class Issue < ActiveRecord::Base return @assignable_versions if @assignable_versions # versions = project.shared_versions.open.all - versions = Version.where(:project_id => project.id, :status => "open").order("created_on desc") + # versions = Version.where(:project_id => project.id, :status => "open").order("created_on desc") + versions = Version.where(:project_id => project.id).order("created_on desc") if fixed_version if fixed_version_id_changed? # nothing to do diff --git a/app/models/organization.rb b/app/models/organization.rb index 50f62ea11..284754c03 100644 --- a/app/models/organization.rb +++ b/app/models/organization.rb @@ -9,6 +9,7 @@ class Organization < ActiveRecord::Base has_many :org_subfields, :dependent => :destroy has_many :users, :through => :org_members has_many :files + has_many :org_messages, :class_name => 'OrgMessage', :dependent => :destroy acts_as_attachable validates_uniqueness_of :name after_create :save_as_org_activity, :add_default_subfields diff --git a/app/views/attachments/_project_file_links.html.erb b/app/views/attachments/_project_file_links.html.erb index cccc8382c..a1a978a48 100644 --- a/app/views/attachments/_project_file_links.html.erb +++ b/app/views/attachments/_project_file_links.html.erb @@ -30,9 +30,9 @@ <% for attachment in attachments %>