Browse Source

Update question header and filters conditions

pull/2077/head
Kat 2 years ago
parent
commit
7e70d066d5
  1. 9
      app/helpers/filters_helper.rb
  2. 2
      app/models/form/sales/questions/managing_organisation.rb
  3. 2
      app/views/logs/_log_filters.html.erb
  4. 2
      spec/models/form/sales/questions/managing_organisation_spec.rb

9
app/helpers/filters_helper.rb

@ -125,11 +125,14 @@ module FiltersHelper
end end
def non_support_with_multiple_owning_orgs? def non_support_with_multiple_owning_orgs?
current_user.organisation.stock_owners.count > 1 || current_user.organisation.has_recent_absorbed_organisations? return true if current_user.organisation.stock_owners.count > 1
return true if current_user.organisation.stock_owners.count.positive? && current_user.organisation.holds_own_stock?
current_user.organisation.has_recent_absorbed_organisations?
end end
def non_support_with_multiple_managing_orgs? def non_support_with_managing_orgs?
current_user.organisation.managing_agents.count > 1 || current_user.organisation.has_recent_absorbed_organisations? current_user.organisation.managing_agents.count >= 1 || current_user.organisation.has_recent_absorbed_organisations?
end end
def user_lettings_path? def user_lettings_path?

2
app/models/form/sales/questions/managing_organisation.rb

@ -3,7 +3,7 @@ class Form::Sales::Questions::ManagingOrganisation < ::Form::Question
super super
@id = "managing_organisation_id" @id = "managing_organisation_id"
@check_answer_label = "Reported by" @check_answer_label = "Reported by"
@header = "Which organisation is reporting this sales log?" @header = "Which organisation is reporting this sale?"
@type = "select" @type = "select"
end end

2
app/views/logs/_log_filters.html.erb

@ -93,7 +93,7 @@
} %> } %>
<% end %> <% end %>
<% if (current_user.support? || non_support_with_multiple_managing_orgs?) && (user_or_org_lettings_path? || FeatureToggle.sales_managing_organisation_enabled?) %> <% if (current_user.support? || non_support_with_managing_orgs?) && (user_or_org_lettings_path? || FeatureToggle.sales_managing_organisation_enabled?) %>
<%= render partial: "filters/radio_filter", locals: { <%= render partial: "filters/radio_filter", locals: {
f:, f:,
options: { options: {

2
spec/models/form/sales/questions/managing_organisation_spec.rb

@ -18,7 +18,7 @@ RSpec.describe Form::Sales::Questions::ManagingOrganisation, type: :model do
end end
it "has the correct header" do it "has the correct header" do
expect(question.header).to eq("Which organisation is reporting this sales log?") expect(question.header).to eq("Which organisation is reporting this sale?")
end end
it "has the correct check_answer_label" do it "has the correct check_answer_label" do

Loading…
Cancel
Save