diff --git a/app/models/issue.rb b/app/models/issue.rb index 08c676b00..11f62b92e 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -106,6 +106,7 @@ class Issue < ApplicationRecord scope :closed, ->{where(status_id: 5)} scope :opened, ->{where.not(status_id: 5)} scope :with_assigner_info, -> { + select("DISTINCT issues.*, u.id AS user_id, CONVERT(COALESCE(u.nickname, u.login) USING gbk) AS user_name"). joins("LEFT JOIN ( SELECT ia.issue_id, ia.assigner_id FROM issue_assigners ia @@ -120,7 +121,7 @@ class Issue < ApplicationRecord scope :ordered_by_assigner, -> (sort_direction) { order("CASE WHEN u.id IS NULL THEN 1 ELSE 0 END ASC") - .order("COALESCE(u.nickname, u.login) #{sort_direction}") + .order("CONVERT(COALESCE(u.nickname, u.login) USING gbk) #{sort_direction}") } after_create :incre_project_common, :incre_user_statistic, :incre_platform_statistic before_save :check_pm_and_update_due_date