mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-09-21 07:26:15 +08:00
Fix user counters on projects overview page [SCI-2847]
This commit is contained in:
parent
eb72ea69dd
commit
145c66a834
|
@ -90,14 +90,14 @@ class ProjectsOverviewService
|
||||||
'visibility = 1 OR user_projects.user_id = :user_id', user_id: @user.id
|
'visibility = 1 OR user_projects.user_id = :user_id', user_id: @user.id
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
projects = projects
|
projects
|
||||||
.select('projects.*')
|
.select('projects.*')
|
||||||
.select('COUNT(DISTINCT user_projects.id) AS user_count')
|
.select('(SELECT COUNT(DISTINCT user_projects.id) FROM user_projects '\
|
||||||
.select('COUNT(DISTINCT comments.id) AS comment_count')
|
'WHERE user_projects.project_id = projects.id) AS user_count')
|
||||||
.select('COUNT(DISTINCT due_modules.id) AS notification_count')
|
.select('COUNT(DISTINCT comments.id) AS comment_count')
|
||||||
.group('projects.id')
|
.select('COUNT(DISTINCT due_modules.id) AS notification_count')
|
||||||
.limit(1_000_000)
|
.group('projects.id')
|
||||||
Project.from(projects, 'projects')
|
.limit(1_000_000)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_dt_records
|
def fetch_dt_records
|
||||||
|
@ -120,13 +120,13 @@ class ProjectsOverviewService
|
||||||
'visibility = 1 OR user_projects.user_id = :user_id', user_id: @user.id
|
'visibility = 1 OR user_projects.user_id = :user_id', user_id: @user.id
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
projects = projects
|
projects
|
||||||
.select('projects.*')
|
.select('projects.*')
|
||||||
.select('COUNT(DISTINCT user_projects.id) AS user_count')
|
.select('(SELECT COUNT(DISTINCT user_projects.id) FROM user_projects '\
|
||||||
.select('COUNT(DISTINCT experiments.id) AS experiment_count')
|
'WHERE user_projects.project_id = projects.id) AS user_count')
|
||||||
.select('COUNT(DISTINCT my_modules.id) AS task_count')
|
.select('COUNT(DISTINCT experiments.id) AS experiment_count')
|
||||||
.group('projects.id')
|
.select('COUNT(DISTINCT my_modules.id) AS task_count')
|
||||||
Project.from(projects, 'projects')
|
.group('projects.id')
|
||||||
end
|
end
|
||||||
|
|
||||||
def search(records, value)
|
def search(records, value)
|
||||||
|
|
Loading…
Reference in a new issue