fixed 个人所有项目包含关注的

This commit is contained in:
xxq250 2025-05-22 09:35:14 +08:00
parent 1c325f412f
commit bf32f58813
1 changed files with 2 additions and 1 deletions

View File

@ -20,7 +20,8 @@ class Projects::ListMyQuery < ApplicationQuery
if params[:category].blank?
normal_projects = projects.members_projects(user.id).to_sql
org_projects = projects.joins(team_projects: [team: :team_users]).where(team_users: {user_id: user.id}).to_sql
projects = Project.from("( #{ normal_projects} UNION #{ org_projects } ) AS projects")#.distinct
watched_projects = projects.where.not(user_id: user.id).joins(:watchers).where(watchers: {watchable_type: "Project", user_id: user.id}).to_sql
projects = Project.from("( #{ normal_projects} UNION #{ org_projects } UNION #{ watched_projects } ) AS projects")#.distinct
elsif params[:category].to_s == "join"
normal_projects = projects.where.not(user_id: user.id).members_projects(user.id).to_sql
org_projects = projects.joins(team_projects: [team: :team_users]).where(team_users: {user_id: user.id}).to_sql