mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-11-09 16:01:30 +08:00
Fix protocol filtering by pablished attributes and draft presence [SCI-8070] (#5099)
This commit is contained in:
parent
2d0a6c387c
commit
4aded6e7b4
1 changed files with 7 additions and 1 deletions
|
|
@ -138,7 +138,13 @@ class ProtocolsDatatable < CustomDatatable
|
|||
records = records.where(protocols: { archived_by_id: params[:archived_by] }) if params[:archived_by].present?
|
||||
|
||||
if params[:has_draft].present?
|
||||
records = records.where(protocols: { protocol_type: Protocol.protocol_types[:in_repository_draft] })
|
||||
records =
|
||||
records
|
||||
.joins("LEFT OUTER JOIN protocols protocol_drafts " \
|
||||
"ON protocol_drafts.protocol_type = #{Protocol.protocol_types[:in_repository_draft]} " \
|
||||
"AND (protocol_drafts.parent_id = protocols.id OR protocol_drafts.parent_id = protocols.parent_id)")
|
||||
.where('protocols.protocol_type = ? OR protocol_drafts.id IS NOT NULL',
|
||||
Protocol.protocol_types[:in_repository_draft])
|
||||
end
|
||||
|
||||
records
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue