Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion app/controllers/paginable/plans_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def org_admin_other_user

paginable_renderise(
partial: "org_admin_other_user",
scope: Plan.active(@user),
scope: Plan.active(@user).where(Role.creator_condition),
query_params: { sort_field: "plans.updated_at", sort_direction: :desc }
)
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/public_pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def template_export
# GET /plans_index
# ------------------------------------------------------------------------------------
def plan_index
@plans = Plan.publicly_visible.includes(:template)
@plans = Plan.where(Role.creator_condition).publicly_visible.includes(:template)
render "plan_index", locals: {
query_params: {
page: paginable_params.fetch(:page, 1),
Expand Down
2 changes: 0 additions & 2 deletions app/models/plan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,11 @@ class Plan < ApplicationRecord
scope :search, lambda { |term|
if date_range?(term: term)
joins(:template, roles: [user: :org])
.where(Role.creator_condition)
.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("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