mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-29 11:45:18 +08:00
Merge pull request #2683 from mlorb/ml-sci-4742
Hide archived and not assigned items … [SCI-4742]
This commit is contained in:
commit
2125c8bf83
2 changed files with 12 additions and 6 deletions
|
@ -38,12 +38,17 @@ class RepositoryDatatableService
|
|||
repository_rows = repository_rows.joins(:my_module_repository_rows)
|
||||
.where(my_module_repository_rows: { my_module_id: @my_module })
|
||||
else
|
||||
repository_rows = repository_rows.joins(
|
||||
'LEFT OUTER JOIN "my_module_repository_rows" '\
|
||||
'ON "my_module_repository_rows"."repository_row_id" = "repository_rows"."id" '\
|
||||
'AND "my_module_repository_rows"."my_module_id" = ' + @my_module.id.to_s
|
||||
).select('CASE WHEN my_module_repository_rows.id IS NOT NULL '\
|
||||
'THEN true ELSE false END as row_assigned').group('my_module_repository_rows.id')
|
||||
repository_rows = repository_rows
|
||||
.joins(:repository)
|
||||
.joins('LEFT OUTER JOIN "my_module_repository_rows" '\
|
||||
'ON "my_module_repository_rows"."repository_row_id" = "repository_rows"."id" '\
|
||||
'AND "my_module_repository_rows"."my_module_id" = ' + @my_module.id.to_s)
|
||||
.select('CASE WHEN my_module_repository_rows.id IS NOT NULL '\
|
||||
'THEN true ELSE false END as row_assigned')
|
||||
.where('my_module_repository_rows.id IS NOT NULL
|
||||
OR (repository_rows.archived = FALSE
|
||||
AND repositories.archived = FALSE)')
|
||||
.group('my_module_repository_rows.id')
|
||||
end
|
||||
end
|
||||
repository_rows = repository_rows
|
||||
|
|
|
@ -84,6 +84,7 @@ module RepositoryRows
|
|||
return [] unless params[:rows_to_assign]
|
||||
|
||||
unassigned_rows = @repository.repository_rows
|
||||
.active
|
||||
.joins("LEFT OUTER JOIN my_module_repository_rows "\
|
||||
"ON repository_rows.id = my_module_repository_rows.repository_row_id "\
|
||||
"AND my_module_repository_rows.my_module_id = #{my_module.id.to_i}")
|
||||
|
|
Loading…
Reference in a new issue