mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-08 07:21:03 +08:00
Merge pull request #8891 from artoscinote/ma_SCI_12277
Fix search through protocol template files [SCI-12277]
This commit is contained in:
commit
0d25d6279e
1 changed files with 7 additions and 2 deletions
|
|
@ -66,6 +66,11 @@ class Asset < ApplicationRecord
|
|||
.where(steps: { protocol: Protocol.search(user, include_archived, nil, teams) })
|
||||
.select(:id)
|
||||
|
||||
assets_in_template_steps =
|
||||
Asset.joins(:step)
|
||||
.where(steps: { protocol: Protocol.search(user, include_archived, nil, teams, { in_repository: true }) })
|
||||
.select(:id)
|
||||
|
||||
assets_in_results = Asset.joins(:result)
|
||||
.where(results: { id: Result.search(user, include_archived, nil, teams) })
|
||||
.select(:id)
|
||||
|
|
@ -78,8 +83,8 @@ class Asset < ApplicationRecord
|
|||
.where.not(repositories: { type: 'RepositorySnapshot' })
|
||||
.select(:id)
|
||||
|
||||
assets = distinct.where('assets.id IN (?) OR assets.id IN (?) OR assets.id IN (?)',
|
||||
assets_in_steps, assets_in_results, assets_in_inventories)
|
||||
assets = distinct.where('assets.id IN (?) OR assets.id IN (?) OR assets.id IN (?) OR assets.id IN (?)',
|
||||
assets_in_steps, assets_in_results, assets_in_inventories, assets_in_template_steps)
|
||||
|
||||
Asset.left_outer_joins(:asset_text_datum)
|
||||
.joins(file_attachment: :blob)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue