Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/plan.rb
Original file line numberDiff line numberDiff line change
Expand Up@@ -169,13 +169,13 @@ class Plan < ApplicationRecord
scope :search, lambda { |term|
if date_range?(term: term)
joins(:template, roles: [user: :org])
.where(Role.creator_condition)
.where(roles: { active: true })
.by_date_range(:created_at, term)
else
search_pattern = "%#{term}%"
joins(:template, roles: [user: :org])
.left_outer_joins(:identifiers, :contributors)
.where(Role.creator_condition)
.where(roles: { active: true })
.where("lower(plans.title) LIKE lower(:search_pattern)
OR lower(orgs.name) LIKE lower (:search_pattern)
OR lower(orgs.abbreviation) LIKE lower (:search_pattern)
Expand Down