Skip to content

keep org filter (scope) in public search #592

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 22, 2021
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
162 changes: 81 additions & 81 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (6.1.1)
actionpack (= 6.1.1)
activesupport (= 6.1.1)
actioncable (6.1.3)
actionpack (= 6.1.3)
activesupport (= 6.1.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.1.1)
actionpack (= 6.1.1)
activejob (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
actionmailbox (6.1.3)
actionpack (= 6.1.3)
activejob (= 6.1.3)
activerecord (= 6.1.3)
activestorage (= 6.1.3)
activesupport (= 6.1.3)
mail (>= 2.7.1)
actionmailer (6.1.1)
actionpack (= 6.1.1)
actionview (= 6.1.1)
activejob (= 6.1.1)
activesupport (= 6.1.1)
actionmailer (6.1.3)
actionpack (= 6.1.3)
actionview (= 6.1.3)
activejob (= 6.1.3)
activesupport (= 6.1.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.1.1)
actionview (= 6.1.1)
activesupport (= 6.1.1)
actionpack (6.1.3)
actionview (= 6.1.3)
activesupport (= 6.1.3)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.1.1)
actionpack (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
actiontext (6.1.3)
actionpack (= 6.1.3)
activerecord (= 6.1.3)
activestorage (= 6.1.3)
activesupport (= 6.1.3)
nokogiri (>= 1.8.5)
actionview (6.1.1)
activesupport (= 6.1.1)
actionview (6.1.3)
activesupport (= 6.1.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
@@ -48,22 +48,22 @@ GEM
kaminari (~> 1.0, >= 1.2.1)
railties (>= 5.2, < 6.2)
ransack (~> 2.1, >= 2.1.1)
activejob (6.1.1)
activesupport (= 6.1.1)
activejob (6.1.3)
activesupport (= 6.1.3)
globalid (>= 0.3.6)
activemodel (6.1.1)
activesupport (= 6.1.1)
activerecord (6.1.1)
activemodel (= 6.1.1)
activesupport (= 6.1.1)
activestorage (6.1.1)
actionpack (= 6.1.1)
activejob (= 6.1.1)
activerecord (= 6.1.1)
activesupport (= 6.1.1)
activemodel (6.1.3)
activesupport (= 6.1.3)
activerecord (6.1.3)
activemodel (= 6.1.3)
activesupport (= 6.1.3)
activestorage (6.1.3)
actionpack (= 6.1.3)
activejob (= 6.1.3)
activerecord (= 6.1.3)
activesupport (= 6.1.3)
marcel (~> 0.3.1)
mimemagic (~> 0.3.2)
activesupport (6.1.1)
activesupport (6.1.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
@@ -76,8 +76,8 @@ GEM
arbre (1.4.0)
activesupport (>= 3.0.0, < 6.2)
ruby2_keywords (>= 0.0.2, < 1.0)
ast (2.4.1)
autoprefixer-rails (10.2.0.0)
ast (2.4.2)
autoprefixer-rails (10.2.4.0)
execjs
bcrypt (3.1.16)
bindex (0.8.1)
@@ -99,16 +99,16 @@ GEM
capistrano-rbenv (2.2.0)
capistrano (~> 3.1)
sshkit (~> 1.3)
capybara (3.34.0)
capybara (3.35.3)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
rack (>= 1.6.0)
rack-test (>= 0.6.3)
regexp_parser (~> 1.5)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
childprocess (3.0.0)
concurrent-ruby (1.1.7)
concurrent-ruby (1.1.8)
connection_pool (2.2.3)
crass (1.0.6)
database_cleaner (1.8.5)
@@ -119,7 +119,7 @@ GEM
responders
warden (~> 1.2.3)
diff-lcs (1.4.4)
docile (1.3.4)
docile (1.3.5)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.6)
@@ -131,16 +131,16 @@ GEM
tzinfo
execjs (2.7.0)
fabrication (2.21.1)
faker (2.15.1)
faker (2.16.0)
i18n (>= 1.6, < 2)
ffi (1.14.2)
formtastic (3.1.5)
actionpack (>= 3.2.13)
formtastic (4.0.0)
actionpack (>= 5.2.0)
formtastic_i18n (0.6.0)
fugit (1.4.1)
fugit (1.4.2)
et-orbi (~> 1.1, >= 1.1.8)
raabro (~> 1.4)
gli (2.19.2)
gli (2.20.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
has_scope (0.7.2)
@@ -150,7 +150,7 @@ GEM
http-cookie (1.0.3)
domain_name (~> 0.5)
http_accept_language (2.1.1)
i18n (1.8.7)
i18n (1.8.9)
concurrent-ruby (~> 1.0)
inherited_resources (1.12.0)
actionpack (>= 5.2, < 6.2)
@@ -189,7 +189,7 @@ GEM
i18n (>= 0.7, < 2)
json (>= 1.7.7)
rest-client (>= 1.8.0)
loofah (2.8.0)
loofah (2.9.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
@@ -199,7 +199,7 @@ GEM
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2020.1104)
mime-types-data (3.2021.0212)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.5.0)
@@ -208,7 +208,7 @@ GEM
net-ssh (>= 2.6.5, < 7.0.0)
net-ssh (6.1.0)
netrc (0.11.0)
nio4r (2.5.4)
nio4r (2.5.5)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
@@ -234,20 +234,20 @@ GEM
rack (2.2.3)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.1.1)
actioncable (= 6.1.1)
actionmailbox (= 6.1.1)
actionmailer (= 6.1.1)
actionpack (= 6.1.1)
actiontext (= 6.1.1)
actionview (= 6.1.1)
activejob (= 6.1.1)
activemodel (= 6.1.1)
activerecord (= 6.1.1)
activestorage (= 6.1.1)
activesupport (= 6.1.1)
rails (6.1.3)
actioncable (= 6.1.3)
actionmailbox (= 6.1.3)
actionmailer (= 6.1.3)
actionpack (= 6.1.3)
actiontext (= 6.1.3)
actionview (= 6.1.3)
activejob (= 6.1.3)
activemodel (= 6.1.3)
activerecord (= 6.1.3)
activestorage (= 6.1.3)
activesupport (= 6.1.3)
bundler (>= 1.15.0)
railties (= 6.1.1)
railties (= 6.1.3)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
@@ -261,16 +261,16 @@ GEM
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 7)
railties (6.1.1)
actionpack (= 6.1.1)
activesupport (= 6.1.1)
railties (6.1.3)
actionpack (= 6.1.3)
activesupport (= 6.1.3)
method_source
rake (>= 0.8.7)
thor (~> 1.0)
rainbow (3.0.0)
raindrops (0.19.1)
rake (13.0.3)
ransack (2.4.1)
ransack (2.4.2)
activerecord (>= 5.2.4)
activesupport (>= 5.2.4)
i18n
@@ -279,7 +279,7 @@ GEM
ffi (~> 1.0)
rdiscount (2.2.0.2)
redis (4.2.5)
regexp_parser (1.8.2)
regexp_parser (2.0.3)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
@@ -295,7 +295,7 @@ GEM
rspec-expectations (3.10.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-mocks (3.10.1)
rspec-mocks (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-rails (4.0.2)
@@ -306,8 +306,8 @@ GEM
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (3.10.1)
rubocop (1.8.0)
rspec-support (3.10.2)
rubocop (1.10.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0)
@@ -316,14 +316,14 @@ GEM
rubocop-ast (>= 1.2.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.4.0)
rubocop-ast (1.4.1)
parser (>= 2.7.1.5)
rubocop-rails (2.9.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 0.90.0, < 2.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.2)
ruby2_keywords (0.0.4)
rubyzip (2.3.0)
sassc (2.4.0)
ffi (~> 1.9)
@@ -337,9 +337,9 @@ GEM
selenium-webdriver (3.142.7)
childprocess (>= 0.5, < 4.0)
rubyzip (>= 1.2.2)
shoulda-matchers (4.4.1)
shoulda-matchers (4.5.1)
activesupport (>= 4.2.0)
sidekiq (6.1.2)
sidekiq (6.1.3)
connection_pool (>= 2.2.2)
rack (~> 2.0)
redis (>= 4.2.0)
@@ -349,7 +349,7 @@ GEM
simple_form (5.0.3)
actionpack (>= 5.0)
activemodel (>= 5.0)
simplecov (0.21.1)
simplecov (0.21.2)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
@@ -366,10 +366,10 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sshkit (1.21.1)
sshkit (1.21.2)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
thor (1.0.1)
thor (1.1.0)
tilt (2.0.10)
ttfunk (1.7.0)
tzinfo (2.0.4)
@@ -390,7 +390,7 @@ GEM
activemodel (>= 6.0.0)
bindex (>= 0.4.0)
railties (>= 6.0.0)
webdrivers (4.4.2)
webdrivers (4.5.0)
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
12 changes: 4 additions & 8 deletions app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
@@ -5,20 +5,16 @@ class PostsController < ApplicationController

def index
context = model.active.of_active_members

if current_organization.present?
context = context.where(
organization_id: current_organization.id
)
end

posts = if (query = params[:q]).present?
context.
search_by_query(query).
page(params[:page]).
per(25)
else
apply_scopes(context).page(params[:page]).per(25)
end
posts = apply_scopes(context)
posts = posts.search_by_query(params[:q]) if params[:q].present?
posts = posts.page(params[:page]).per(25)

instance_variable_set("@#{resources}", posts)
end
2 changes: 0 additions & 2 deletions app/services/report/csv.rb
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@

module Report
module Csv
MIME_TYPE = Mime[:csv]

def self.run(headers, rows)
::CSV.generate do |csv|
csv << headers
17 changes: 17 additions & 0 deletions app/services/report/csv/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Report
module Csv
class Base
def name
@decorator.name(:csv)
end

def mime_type
Mime[:csv]
end

def run
Report::Csv.run(@decorator.headers, @decorator.rows)
end
end
end
end
17 changes: 2 additions & 15 deletions app/services/report/csv/member.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
module Report
module Csv
class Member
class Member < Base
def initialize(org, collection)
@collection = collection
@decorator = MemberReportDecorator.new(org, @collection)
end

def name
@decorator.name(:csv)
end

def mime_type
Report::Csv::MIME_TYPE
end

def run
Report::Csv.run(@decorator.headers, @decorator.rows)
@decorator = MemberReportDecorator.new(org, collection)
end
end
end
18 changes: 2 additions & 16 deletions app/services/report/csv/post.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
module Report
module Csv
class Post
class Post < Base
def initialize(org, collection, type)
@collection = collection
@type = type
@decorator = PostReportDecorator.new(org, @collection, @type)
end

def name
@decorator.name(:csv)
end

def mime_type
Report::Csv::MIME_TYPE
end

def run
Report::Csv.run(@decorator.headers, @decorator.rows)
@decorator = PostReportDecorator.new(org, collection, type)
end
end
end
2 changes: 0 additions & 2 deletions app/services/report/pdf.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module Report
module Pdf
MIME_TYPE = Mime[:pdf]

def self.run(headers, rows)
pdf = Prawn::Document.new(options)
pdf.table [headers] + rows
17 changes: 17 additions & 0 deletions app/services/report/pdf/base.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Report
module Pdf
class Base
def name
@decorator.name(:pdf)
end

def mime_type
Mime[:pdf]
end

def run
Report::Pdf.run(@decorator.headers, @decorator.rows)
end
end
end
end
17 changes: 2 additions & 15 deletions app/services/report/pdf/member.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
module Report
module Pdf
class Member
class Member < Base
def initialize(org, collection)
@collection = collection
@decorator = MemberReportDecorator.new(org, @collection)
end

def name
@decorator.name(:pdf)
end

def mime_type
Report::Pdf::MIME_TYPE
end

def run
Report::Pdf.run(@decorator.headers, @decorator.rows)
@decorator = MemberReportDecorator.new(org, collection)
end
end
end
18 changes: 2 additions & 16 deletions app/services/report/pdf/post.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
module Report
module Pdf
class Post
class Post < Base
def initialize(org, collection, type)
@collection = collection
@type = type
@decorator = PostReportDecorator.new(org, @collection, @type)
end

def name
@decorator.name(:pdf)
end

def mime_type
Report::Pdf::MIME_TYPE
end

def run
Report::Pdf.run(@decorator.headers, @decorator.rows)
@decorator = PostReportDecorator.new(org, collection, type)
end
end
end
40 changes: 1 addition & 39 deletions app/views/inquiries/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
<% @category = Category.where(id: params[:cat]).first %>

<div class="container-fluid">
<div class="row">
<div class="col-md-12">
@@ -13,43 +11,7 @@

<div class="container-fluid">
<div class="row">
<div class="col-md-8">
<form action="<%= inquiries_path %>"
class="navbar-form navbar-left"
method="get"
role="search">
<div class="form-group">
<input class="form-control"
name="q"
placeholder="<%= t("global.search") %>"
type="text"
value="<%= params[:q] %>">
</div>
<button class="btn btn-default" type="submit">
<%= t("global.search") %>
</button>
</form>

<ul class="to-categories-dropdown nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown">
<%= @category ? @category.name : Category.model_name.human %>
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<%= link_to #{t("global.all")}", inquiries_path %>
</li>
<% Category.all.sort_by { |a| a.name.downcase }.each do |c| %>
<% next if c == @category %>
<li>
<%= link_to c.name, inquiries_path(cat: c.id) %>
</li>
<% end %>
</ul>
</li>
</ul>
</div>
<%= render "shared/post_filters", base_path: inquiries_path %>

<div class="col-md-4">
<% if current_user && current_organization && !params[:org] %>
39 changes: 1 addition & 38 deletions app/views/offers/index.html.erb
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
<div class="row">
<div class="col-md-12">
<h1>
<% @category = Category.where(id: params[:cat]).first %>
<%= Offer.model_name.human(count: :many) %>
<%= render "shared/show_filter_hint" %>
</h1>
@@ -12,43 +11,7 @@

<div class="container-fluid">
<div class="row">
<div class="col-md-8">
<form action="<%= offers_path %>"
class="navbar-form navbar-left"
method="get"
role="search">
<div class="form-group">
<input class="form-control"
name="q"
placeholder="<%= t 'global.search' %>"
type="text"
value="<%= params[:q] %>">
</div>
<button class="btn btn-default" type="submit">
<%= t 'global.search' %>
</button>
</form>

<ul class="to-categories-dropdown nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown">
<%= @category ? @category.name : Category.model_name.human %>
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<%= link_to #{t 'global.all'}", offers_path %>
</li>
<% Category.all.sort_by { |a| a.name.downcase }.each do |c| %>
<% next if c == @category %>
<li>
<%= link_to c.name, offers_path(cat: c.id) %>
</li>
<% end %>
</ul>
</li>
</ul>
</div>
<%= render "shared/post_filters", base_path: offers_path %>

<div class="col-md-4">
<% if current_user && current_organization && !params[:org] %>
4 changes: 2 additions & 2 deletions app/views/organizations/index.html.erb
Original file line number Diff line number Diff line change
@@ -18,15 +18,15 @@
<tr>
<th><%= Organization.model_name.human(count: :one) %></th>
<th><%= t '.member_count' %></th>
<th><%= glyph :wrench %><%= t 'global.table.actions' %></th>
<th></th>
</tr>
</thead>
<tbody>
<% @organizations.each do |org| %>
<tr>
<td><%= link_to org.name, org %></td>
<td><%= org.users.count %></td>
<td class="hover-actions">
<td>
<% if current_user&.admins?(org) %>
<%= link_to edit_organization_path(org), class: 'action' do %>
<%= glyph :pencil %>
40 changes: 40 additions & 0 deletions app/views/shared/_post_filters.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<% @category = Category.find_by(id: params[:cat]) %>

<div class="col-md-8">
<form action="<%= base_path %>"
class="navbar-form navbar-left"
method="get"
role="search">
<%= hidden_field_tag(:org, params[:org]) if params[:org].present? %>
<div class="form-group">
<input class="form-control"
name="q"
placeholder="<%= t("global.search") %>"
type="text"
value="<%= params[:q] %>">
</div>
<button class="btn btn-default" type="submit">
<%= t("global.search") %>
</button>
</form>

<ul class="to-categories-dropdown nav navbar-nav">
<li class="dropdown">
<a class="dropdown-toggle" href="#" data-toggle="dropdown">
<%= @category ? @category.name : Category.model_name.human %>
<span class="caret"></span>
</a>
<ul class="dropdown-menu" role="menu">
<li>
<%= link_to #{t("global.all")}", base_path %>
</li>
<% Category.all.sort_by { |a| a.name.downcase }.each do |c| %>
<% next if c == @category %>
<li>
<%= link_to c.name, "#{base_path}?cat=#{c.id}" %>
</li>
<% end %>
</ul>
</li>
</ul>
</div>
4 changes: 2 additions & 2 deletions app/views/users/_user_row.html.erb
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
<td> <%= phone_to member.phone %> </td>
<td> <%= member.account_balance %> </td>
<% if current_user.manages?(current_organization) %>
<td class="hover-actions">
<td>
<% if member.active? %>
<%= render 'toggle_manager_link', member: member if can_toggle_manager?(member) %>
<% else %>
@@ -19,4 +19,4 @@
<%= render 'toggle_active_link', member: member if can_toggle_active?(member) %>
</td>
<% end %>
<% end %>
<% end %>
22 changes: 13 additions & 9 deletions spec/controllers/offers_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -19,9 +19,9 @@

describe "GET #index" do
context "with a logged user" do
it "populates an array of offers" do
login(another_member.user)
before { login(another_member.user) }

it "populates an array of offers" do
get :index

expect(assigns(:offers)).to eq([other_offer, offer])
@@ -34,8 +34,6 @@
end

it "only returns active offers" do
login(another_member.user)

get :index

expect(assigns(:offers)).to eq([offer])
@@ -49,14 +47,13 @@
end

it "only returns offers from active users" do
login(another_member.user)

get :index

expect(assigns(:offers)).to eq([other_offer])
end
end
end

context "with another organization" do
it "skips the original org's offers" do
login(yet_another_member.user)
@@ -69,10 +66,11 @@
end

describe "GET #index (search)" do
before { login(another_member.user) }
before do
offer.title = "Queridos compañeros"
offer.save!
login(another_member.user)

offer.title = "Queridos compañeros"
offer.save!
end

it "populates an array of offers" do
@@ -87,6 +85,12 @@
expect(assigns(:offers)).to eq([offer])
end

it "applies organization filter if passed" do
get :index, params: { q: offer.title, org: 2 }

expect(assigns(:offers)).to eq([])
end

context "when one offer is not active" do
before do
other_offer.active = false
27 changes: 23 additions & 4 deletions spec/controllers/reports_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -23,12 +23,31 @@
end
end

describe 'GET #post_list' do
context 'with a logged user' do
context 'with a logged user' do
before { login(member1.user) }

describe 'GET #user_list' do
it 'downloads a csv' do
get :user_list, params: { format: 'csv' }

report = Report::Csv::Member.new(test_organization, test_organization.members.active)
expect(response.body).to match(report.run)
expect(response.media_type).to eq("text/csv")
end

it 'downloads a pdf' do
get :user_list, params: { format: 'pdf' }

report = Report::Pdf::Member.new(test_organization, test_organization.members.active)
expect(response.body).to eq(report.run)
expect(response.media_type).to eq("application/pdf")
end
end

describe 'GET #post_list' do
it 'do NOT show the inactive members' do
login(member1.user)
get :post_list, params: { type: 'offer' }

get 'post_list', params: { type: 'offer' }
posts = assigns(:posts)[0][1]
expect(posts.size).to eq(active_organization_offers.size)
expect(posts.map(&:id)).to match_array(active_organization_offers.map(&:id))