From 7f1997234780fd39a878bc2cc4c19b967bd322ff Mon Sep 17 00:00:00 2001 From: yystopf Date: Sat, 14 Sep 2024 14:18:51 +0800 Subject: [PATCH 1/3] fix --- app/controllers/api/pm/issues_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/pm/issues_controller.rb b/app/controllers/api/pm/issues_controller.rb index f6dfd39b3..a10a70bce 100644 --- a/app/controllers/api/pm/issues_controller.rb +++ b/app/controllers/api/pm/issues_controller.rb @@ -145,7 +145,7 @@ class Api::Pm::IssuesController < Api::Pm::BaseController end p.workbook.add_worksheet(:name => 'link_relations') do |sheet| # links = PmLink.joins(:linkable_issue).where(issues: {pm_project_id: params[:pm_project_id]}) - links = PmLink.find_by_sql("SELECT `pm_links`.* FROM `pm_links` INNER JOIN `issues` ON `issues`.`id` = `pm_links`.`linkable_id` AND `pm_links`.`linkable_type` = 'Issue' WHERE `issues`.`pm_project_id` = #{params[pm_project_id]}") + links = PmLink.find_by_sql("SELECT `pm_links`.* FROM `pm_links` INNER JOIN `issues` ON `issues`.`id` = `pm_links`.`linkable_id` AND `pm_links`.`linkable_type` = 'Issue' WHERE `issues`.`pm_project_id` = #{params[:pm_project_id]}") sheet.add_row ["ID", "被关联工作项ID"] links.each do |link| sheet.add_row [link.linkable_id, link.be_linkable_id] From 46381e90d17081c8a39a6c5000fdbfb1d5dba687 Mon Sep 17 00:00:00 2001 From: yystopf Date: Wed, 18 Sep 2024 11:01:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=9F=A5=E8=AF=A2=E6=A0=87=E7=AD=BE=E6=9C=AA=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=85=A8=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/concerns/matchable.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/concerns/matchable.rb b/app/models/concerns/matchable.rb index 27e5a0dda..3ada903af 100644 --- a/app/models/concerns/matchable.rb +++ b/app/models/concerns/matchable.rb @@ -6,8 +6,8 @@ module Matchable scope :with_project_language, ->(language_id) { where(project_language_id: language_id) unless language_id.blank? } scope :with_project_type, ->(project_type) { where(project_type: project_type) if Project.project_types.include?(project_type) } scope :by_name_or_identifier, ->(search) { where("name like :search or identifier LIKE :search", :search => "%#{search.split(" ").join('|')}%") unless search.blank? } - scope :with_project_topic, ->(topic_id) {joins(:project_topics).where(project_topics: {id: topic_id}) unless topic_id.blank?} - scope :with_project_topic_name, ->(topic_name) {joins(:project_topics).where(project_topics: {name: topic_name}) unless topic_name.blank?} + scope :with_project_topic, ->(topic_id) {left_outer_joins(:project_topics).where(project_topics: {id: topic_id}) unless topic_id.blank?} + scope :with_project_topic_name, ->(topic_name) {left_outer_joins(:project_topics).where(project_topics: {name: topic_name}) unless topic_name.blank?} end end From 5823ec6f8ce5ab15eb0294dcfc1e48251904287c Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 18 Sep 2024 11:49:10 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fixed=20issue=E6=80=BB=E6=95=B0=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/v1/issues/list_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/api/v1/issues/list_service.rb b/app/services/api/v1/issues/list_service.rb index 40dc2669e..a86b6d875 100644 --- a/app/services/api/v1/issues/list_service.rb +++ b/app/services/api/v1/issues/list_service.rb @@ -64,7 +64,7 @@ class Api::V1::Issues::ListService < ApplicationService private def issue_query_data issues = @project&.id.zero? ? Issue.issue_issue : @project.issues.issue_issue - @total_issues_count = issues.where(pm_issue_type:[1, 2, 3]).distinct.size + @total_issues_count = pm_project_id.present? ? issues.where(pm_issue_type:[1, 2, 3]).count : issues.count case participant_category when 'aboutme' # 关于我的 issues = issues.joins(:issue_participants).where(issue_participants: {participant_type: %w[authored assigned atme], participant_id: participator&.id})