mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-06 03:46:39 +08:00
Show all experiments and tasks for archived projects [SCI-2785]
This commit is contained in:
parent
9fd99d9fc5
commit
e9a8826a1e
1 changed files with 9 additions and 6 deletions
|
@ -99,13 +99,16 @@ class ProjectsOverviewService
|
||||||
def fetch_dt_records
|
def fetch_dt_records
|
||||||
projects = @team.projects.joins(
|
projects = @team.projects.joins(
|
||||||
'LEFT OUTER JOIN user_projects ON user_projects.project_id = projects.id'
|
'LEFT OUTER JOIN user_projects ON user_projects.project_id = projects.id'
|
||||||
).joins(
|
|
||||||
'LEFT OUTER JOIN experiments ON experiments.project_id = projects.id'\
|
|
||||||
' AND experiments.archived = projects.archived'
|
|
||||||
).joins(
|
|
||||||
'LEFT OUTER JOIN my_modules ON my_modules.experiment_id = experiments.id'\
|
|
||||||
' AND my_modules.archived = projects.archived'
|
|
||||||
)
|
)
|
||||||
|
exp_join =
|
||||||
|
'LEFT OUTER JOIN experiments ON experiments.project_id = projects.id'
|
||||||
|
task_join =
|
||||||
|
'LEFT OUTER JOIN my_modules ON my_modules.experiment_id = experiments.id'
|
||||||
|
unless @params[:filter] == 'archived'
|
||||||
|
exp_join += ' AND experiments.archived = projects.archived'
|
||||||
|
task_join += ' AND my_modules.archived = projects.archived'
|
||||||
|
end
|
||||||
|
projects = projects.joins(exp_join).joins(task_join)
|
||||||
|
|
||||||
# Only admins see all projects of the team
|
# Only admins see all projects of the team
|
||||||
unless @user.is_admin_of_team?(@team)
|
unless @user.is_admin_of_team?(@team)
|
||||||
|
|
Loading…
Add table
Reference in a new issue