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