From 95fc52024b67e109dc54b7537be62a472cc5446c Mon Sep 17 00:00:00 2001 From: moveson Date: Thu, 19 Dec 2024 16:18:28 -0700 Subject: [PATCH 1/5] Rename Withdraw Entrants to Manage Entrants --- app/controllers/lotteries_controller.rb | 4 ++-- app/policies/lottery_policy.rb | 2 +- app/views/lotteries/_admin_tabs.html.erb | 4 ++-- ...nts_table.html.erb => _manage_entrants_table.html.erb} | 0 ...ithdraw_entrants.html.erb => manage_entrants.html.erb} | 8 ++++---- config/routes.rb | 2 +- .../system/lotteries/visit_withdraw_entrants_view_spec.rb | 4 ++-- spec/system/lotteries/withdraw_entrants_spec.rb | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) rename app/views/lotteries/{_withdraw_entrants_table.html.erb => _manage_entrants_table.html.erb} (100%) rename app/views/lotteries/{withdraw_entrants.html.erb => manage_entrants.html.erb} (70%) diff --git a/app/controllers/lotteries_controller.rb b/app/controllers/lotteries_controller.rb index 9f2285f52..c6a6340be 100644 --- a/app/controllers/lotteries_controller.rb +++ b/app/controllers/lotteries_controller.rb @@ -91,8 +91,8 @@ def setup @presenter = LotteryPresenter.new(@lottery, view_context) end - # GET /organizations/:organization_id/lotteries/:id/withdraw_entrants - def withdraw_entrants + # GET /organizations/:organization_id/lotteries/:id/manage_entrants + def manage_entrants @presenter = LotteryPresenter.new(@lottery, view_context) end diff --git a/app/policies/lottery_policy.rb b/app/policies/lottery_policy.rb index f8115792c..0a3ef66c8 100644 --- a/app/policies/lottery_policy.rb +++ b/app/policies/lottery_policy.rb @@ -49,7 +49,7 @@ def setup? new? end - def withdraw_entrants? + def manage_entrants? new? end diff --git a/app/views/lotteries/_admin_tabs.html.erb b/app/views/lotteries/_admin_tabs.html.erb index 0a10689bb..37e44913e 100644 --- a/app/views/lotteries/_admin_tabs.html.erb +++ b/app/views/lotteries/_admin_tabs.html.erb @@ -7,8 +7,8 @@ <%= content_tag :li, class: "nav-item #{'active' if presenter.action_name == 'draw_tickets'}" do %> <%= link_to "Draw Tickets", draw_tickets_organization_lottery_path(presenter.organization, presenter.lottery) %> <% end %> - <%= content_tag :li, class: "nav-item #{'active' if presenter.action_name == 'withdraw_entrants'}" do %> - <%= link_to "Withdraw Entrants", withdraw_entrants_organization_lottery_path(presenter.organization, presenter.lottery) %> + <%= content_tag :li, class: "nav-item #{'active' if presenter.action_name == 'manage_entrants'}" do %> + <%= link_to "Manage Entrants", manage_entrants_organization_lottery_path(presenter.organization, presenter.lottery) %> <% end %> <%= content_tag :li, class: "nav-item #{'active' if presenter.controller_name == 'partners'}" do %> <%= link_to "Partners", organization_lottery_partners_path(presenter.organization, presenter.lottery) %> diff --git a/app/views/lotteries/_withdraw_entrants_table.html.erb b/app/views/lotteries/_manage_entrants_table.html.erb similarity index 100% rename from app/views/lotteries/_withdraw_entrants_table.html.erb rename to app/views/lotteries/_manage_entrants_table.html.erb diff --git a/app/views/lotteries/withdraw_entrants.html.erb b/app/views/lotteries/manage_entrants.html.erb similarity index 70% rename from app/views/lotteries/withdraw_entrants.html.erb rename to app/views/lotteries/manage_entrants.html.erb index 064d0167b..db5f7a4b5 100644 --- a/app/views/lotteries/withdraw_entrants.html.erb +++ b/app/views/lotteries/manage_entrants.html.erb @@ -2,7 +2,7 @@ <% "OpenSplitTime: Withdraw Lottery Entrants - #{@presenter.name}" %> <% end %> -<%= render "lotteries/header", presenter: @presenter, breadcrumbs: ["Withdraw Entrants"] %> +<%= render "lotteries/header", presenter: @presenter, breadcrumbs: ["Manage Entrants"] %>
<% if @presenter.lottery_draws.present? %> @@ -11,16 +11,16 @@

<%= "#{division.name}" %>

Accepted
- <%= render partial: "withdraw_entrants_table", locals: { entrants: division.accepted_entrants } %> + <%= render partial: "manage_entrants_table", locals: { entrants: division.accepted_entrants } %> <% if division.wait_list_entrants.present? %>
Wait List
- <%= render partial: "withdraw_entrants_table", locals: { entrants: division.wait_list_entrants } %> + <%= render partial: "manage_entrants_table", locals: { entrants: division.wait_list_entrants } %> <% end %> <% if division.withdrawn_entrants.present? %>
Withdrawn
- <%= render partial: "withdraw_entrants_table", locals: { entrants: division.withdrawn_entrants } %> + <%= render partial: "manage_entrants_table", locals: { entrants: division.withdrawn_entrants } %> <% end %>
diff --git a/config/routes.rb b/config/routes.rb index 241277b3d..801977bd4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -236,7 +236,7 @@ member { get :draw_tickets } member { get :export_entrants } member { get :setup } - member { get :withdraw_entrants } + member { get :manage_entrants } member { post :sync_calculations } member { post :draw } member { post :generate_entrants } diff --git a/spec/system/lotteries/visit_withdraw_entrants_view_spec.rb b/spec/system/lotteries/visit_withdraw_entrants_view_spec.rb index 74c15e23f..ab226c42d 100644 --- a/spec/system/lotteries/visit_withdraw_entrants_view_spec.rb +++ b/spec/system/lotteries/visit_withdraw_entrants_view_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -RSpec.describe "visit a lottery withdraw entrants page" do +RSpec.describe "visit a lottery manage entrants page" do let(:user) { users(:third_user) } let(:owner) { users(:fourth_user) } let(:steward) { users(:fifth_user) } @@ -55,7 +55,7 @@ end def visit_page - visit withdraw_entrants_organization_lottery_path(organization, lottery) + visit manage_entrants_organization_lottery_path(organization, lottery) end def verify_all_content_present diff --git a/spec/system/lotteries/withdraw_entrants_spec.rb b/spec/system/lotteries/withdraw_entrants_spec.rb index 848826595..6ed9b639d 100644 --- a/spec/system/lotteries/withdraw_entrants_spec.rb +++ b/spec/system/lotteries/withdraw_entrants_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -RSpec.describe "withdraw entrants from the lottery withdraw_entrants page", js: true do +RSpec.describe "withdraw entrants and review service from the lottery manage_entrants page", js: true do include ActionView::RecordIdentifier let(:steward) { users(:fifth_user) } @@ -75,6 +75,6 @@ def login_and_visit_page end def visit_page - visit withdraw_entrants_organization_lottery_path(organization, lottery) + visit manage_entrants_organization_lottery_path(organization, lottery) end end From 5c543c93e41c66138b199dfe8433b38aec1fe926 Mon Sep 17 00:00:00 2001 From: moveson Date: Thu, 19 Dec 2024 16:21:00 -0700 Subject: [PATCH 2/5] Remove most references to service_completed_date --- .../resources/lottery_entrant_resource.rb | 1 - app/models/lottery_entrant.rb | 6 ++++++ app/parameters/lottery_entrant_parameters.rb | 1 - .../lotteries/_entrant_for_results.html.erb | 2 +- app/views/lottery_entrants/_form.html.erb | 7 ------- .../_service_completed_form.html.erb | 2 +- .../_service_completed_indicator.html.erb | 2 +- spec/fixtures/lottery_entrants.yml | 18 ------------------ .../system/lotteries/withdraw_entrants_spec.rb | 4 ++-- 9 files changed, 11 insertions(+), 32 deletions(-) diff --git a/app/madmin/resources/lottery_entrant_resource.rb b/app/madmin/resources/lottery_entrant_resource.rb index 91589f6d6..6b4b84e26 100644 --- a/app/madmin/resources/lottery_entrant_resource.rb +++ b/app/madmin/resources/lottery_entrant_resource.rb @@ -17,7 +17,6 @@ class LotteryEntrantResource < Madmin::Resource attribute :pre_selected attribute :external_id attribute :withdrawn - attribute :service_completed_date # Associations attribute :division diff --git a/app/models/lottery_entrant.rb b/app/models/lottery_entrant.rb index a4cc540fe..4c0666407 100644 --- a/app/models/lottery_entrant.rb +++ b/app/models/lottery_entrant.rb @@ -7,6 +7,8 @@ class LotteryEntrant < ApplicationRecord include Delegable include CapitalizeAttributes + # self.ignored_columns = %w[service_completed_date] + belongs_to :person, optional: true belongs_to :division, class_name: "LotteryDivision", foreign_key: "lottery_division_id", touch: true has_many :tickets, class_name: "LotteryTicket", dependent: :destroy @@ -75,6 +77,10 @@ def drawn? tickets.joins(:draw).exists? end + def service_completed? + service_detail.present? && service_detail.completed_date? + end + def to_s full_name end diff --git a/app/parameters/lottery_entrant_parameters.rb b/app/parameters/lottery_entrant_parameters.rb index 962159c0b..1a009a8e9 100644 --- a/app/parameters/lottery_entrant_parameters.rb +++ b/app/parameters/lottery_entrant_parameters.rb @@ -42,7 +42,6 @@ def self.permitted :lottery_division_id, :number_of_tickets, :pre_selected, - :service_completed_date, :state_code, :withdrawn, ] diff --git a/app/views/lotteries/_entrant_for_results.html.erb b/app/views/lotteries/_entrant_for_results.html.erb index 085a8877a..10ac163ed 100644 --- a/app/views/lotteries/_entrant_for_results.html.erb +++ b/app/views/lotteries/_entrant_for_results.html.erb @@ -1,5 +1,5 @@
  • <%= "#{entrant.name} (#{entrant.flexible_geolocation})" %> - <% if !entrant.withdrawn? && entrant.service_completed_date? %> + <% if !entrant.withdrawn? && entrant.service_completed? %> <%= fa_icon("circle-check", text: "Service Form Received", type: :solid, class: "text-success") %> <% end %>
  • diff --git a/app/views/lottery_entrants/_form.html.erb b/app/views/lottery_entrants/_form.html.erb index 97b12ebe1..1d7964736 100644 --- a/app/views/lottery_entrants/_form.html.erb +++ b/app/views/lottery_entrants/_form.html.erb @@ -69,13 +69,6 @@ -
    -
    - <%= f.label :service_completed_date, class: "mb-1" %> - <%= f.text_field :service_completed_date, class: "form-control", placeholder: "mm/dd/yyyy" %> -
    -
    -
    diff --git a/app/views/lottery_entrants/_service_completed_form.html.erb b/app/views/lottery_entrants/_service_completed_form.html.erb index 2f19c6930..ec61221c2 100644 --- a/app/views/lottery_entrants/_service_completed_form.html.erb +++ b/app/views/lottery_entrants/_service_completed_form.html.erb @@ -3,6 +3,6 @@ <%= f.text_field :service_completed_date, placeholder: "mm/dd/yyyy", id: dom_id(entrant, :service_completed_date_input), - value: (l(entrant.service_completed_date, format: :default_full_year) if entrant.service_completed_date?) %> + value: (l(entrant.service_completed_date, format: :default_full_year) if entrant.service_completed?) %>
    <% end %> diff --git a/app/views/lottery_entrants/_service_completed_indicator.html.erb b/app/views/lottery_entrants/_service_completed_indicator.html.erb index 65efec861..3eaf85002 100644 --- a/app/views/lottery_entrants/_service_completed_indicator.html.erb +++ b/app/views/lottery_entrants/_service_completed_indicator.html.erb @@ -1,5 +1,5 @@ <%= content_tag(:div, id: dom_id(entrant, :service_completed_indicator)) do %> - <%= entrant.service_completed_date? ? + <%= entrant.service_completed? ? fa_icon("circle-check", type: :solid, class: "text-success") : fa_icon("circle-xmark", type: :regular, class: "text-danger") %> <% end %> diff --git a/spec/fixtures/lottery_entrants.yml b/spec/fixtures/lottery_entrants.yml index dd7759363..b06276c26 100644 --- a/spec/fixtures/lottery_entrants.yml +++ b/spec/fixtures/lottery_entrants.yml @@ -15,7 +15,6 @@ lottery_entrant_0001: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0002: id: 5 lottery_division_id: 1 @@ -32,7 +31,6 @@ lottery_entrant_0002: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0003: id: 6 lottery_division_id: 2 @@ -49,7 +47,6 @@ lottery_entrant_0003: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0004: id: 7 lottery_division_id: 1 @@ -66,7 +63,6 @@ lottery_entrant_0004: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0005: id: 8 lottery_division_id: 2 @@ -83,7 +79,6 @@ lottery_entrant_0005: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0006: id: 9 lottery_division_id: 1 @@ -100,7 +95,6 @@ lottery_entrant_0006: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0007: id: 10 lottery_division_id: 2 @@ -117,7 +111,6 @@ lottery_entrant_0007: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0008: id: 11 lottery_division_id: 1 @@ -134,7 +127,6 @@ lottery_entrant_0008: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0009: id: 12 lottery_division_id: 2 @@ -151,7 +143,6 @@ lottery_entrant_0009: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0010: id: 13 lottery_division_id: 1 @@ -168,7 +159,6 @@ lottery_entrant_0010: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0011: id: 21 lottery_division_id: 6 @@ -185,7 +175,6 @@ lottery_entrant_0011: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0012: id: 22 lottery_division_id: 7 @@ -202,7 +191,6 @@ lottery_entrant_0012: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0013: id: 23 lottery_division_id: 7 @@ -219,7 +207,6 @@ lottery_entrant_0013: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0014: id: 24 lottery_division_id: 8 @@ -236,7 +223,6 @@ lottery_entrant_0014: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0015: id: 25 lottery_division_id: 8 @@ -253,7 +239,6 @@ lottery_entrant_0015: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0016: id: 26 lottery_division_id: 8 @@ -270,7 +255,6 @@ lottery_entrant_0016: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0017: id: 27 lottery_division_id: 8 @@ -287,7 +271,6 @@ lottery_entrant_0017: pre_selected: false external_id: withdrawn: - service_completed_date: lottery_entrant_0018: id: 28 lottery_division_id: 8 @@ -304,4 +287,3 @@ lottery_entrant_0018: pre_selected: false external_id: withdrawn: - service_completed_date: diff --git a/spec/system/lotteries/withdraw_entrants_spec.rb b/spec/system/lotteries/withdraw_entrants_spec.rb index 6ed9b639d..22f3d5367 100644 --- a/spec/system/lotteries/withdraw_entrants_spec.rb +++ b/spec/system/lotteries/withdraw_entrants_spec.rb @@ -41,7 +41,7 @@ end.to change { entrant.reload.withdrawn? }.from(true).to(false) end - scenario "The user adds a service form to an entrant" do + xscenario "The user adds a service form to an entrant" do login_and_visit_page expect do @@ -54,7 +54,7 @@ end.to change { entrant.reload.service_completed_date }.from(nil).to("2023-05-15".to_date) end - scenario "The user removes a service form from an entrant" do + xscenario "The user removes a service form from an entrant" do entrant.update(service_completed_date: "2023-05-15".to_date) login_and_visit_page From dcef5eb075485dd7b4992279c37159073990bb69 Mon Sep 17 00:00:00 2001 From: moveson Date: Thu, 19 Dec 2024 16:47:43 -0700 Subject: [PATCH 3/5] Remove final references to service_completed_date --- app/helpers/lotteries/entrant_service_details_helper.rb | 4 ++-- app/models/lottery_entrant.rb | 2 +- app/views/lotteries/_manage_entrants_table.html.erb | 6 ++---- .../_service_form_status_card.html.erb | 2 ++ .../lottery_entrants/_service_completed_form.html.erb | 8 -------- .../_service_completed_indicator.html.erb | 5 ----- .../lottery_entrants/_service_status_indicator.html.erb | 5 +++++ 7 files changed, 12 insertions(+), 20 deletions(-) delete mode 100644 app/views/lottery_entrants/_service_completed_form.html.erb delete mode 100644 app/views/lottery_entrants/_service_completed_indicator.html.erb create mode 100644 app/views/lottery_entrants/_service_status_indicator.html.erb diff --git a/app/helpers/lotteries/entrant_service_details_helper.rb b/app/helpers/lotteries/entrant_service_details_helper.rb index 70998cab5..56159b7fc 100644 --- a/app/helpers/lotteries/entrant_service_details_helper.rb +++ b/app/helpers/lotteries/entrant_service_details_helper.rb @@ -13,7 +13,7 @@ def button_to_remove_completed_service_form(presenter) def service_form_status_with_icon(entrant_service_detail) case - when entrant_service_detail.completed_form.blank? + when entrant_service_detail.nil? || entrant_service_detail.completed_form.blank? title = "Not received" icon = "file-slash" color = "warning" @@ -31,6 +31,6 @@ def service_form_status_with_icon(entrant_service_detail) color = "secondary" end - content_tag :span, fa_icon(icon, type: :regular, text: title, class: "fs-4 text-#{color}"), class: "fw-bold fs-5" + content_tag :span, fa_icon(icon, type: :regular, text: title, class: "text-#{color}") end end diff --git a/app/models/lottery_entrant.rb b/app/models/lottery_entrant.rb index 4c0666407..6cee157fe 100644 --- a/app/models/lottery_entrant.rb +++ b/app/models/lottery_entrant.rb @@ -7,7 +7,7 @@ class LotteryEntrant < ApplicationRecord include Delegable include CapitalizeAttributes - # self.ignored_columns = %w[service_completed_date] + self.ignored_columns = %w[service_completed_date] belongs_to :person, optional: true belongs_to :division, class_name: "LotteryDivision", foreign_key: "lottery_division_id", touch: true diff --git a/app/views/lotteries/_manage_entrants_table.html.erb b/app/views/lotteries/_manage_entrants_table.html.erb index e0bf46345..1cc438f4e 100644 --- a/app/views/lotteries/_manage_entrants_table.html.erb +++ b/app/views/lotteries/_manage_entrants_table.html.erb @@ -8,8 +8,7 @@ Gender From Withdrawn? - Service Form Received - Completed? + Service Status @@ -20,8 +19,7 @@ <%= entrant.gender.titleize %> <%= entrant.flexible_geolocation %> <%= render partial: "lottery_entrants/withdrawn_form", locals: { organization: @presenter.organization, lottery: @presenter.lottery, entrant: entrant } %> - <%= render partial: "lottery_entrants/service_completed_form", locals: { organization: @presenter.organization, lottery: @presenter.lottery, entrant: entrant } %> - <%= render partial: "lottery_entrants/service_completed_indicator", locals: { entrant: entrant } %> + <%= render partial: "lottery_entrants/service_status_indicator", locals: { entrant: entrant } %> <% end %> diff --git a/app/views/lotteries/entrant_service_details/_service_form_status_card.html.erb b/app/views/lotteries/entrant_service_details/_service_form_status_card.html.erb index 7dae276a2..c7f6aedba 100644 --- a/app/views/lotteries/entrant_service_details/_service_form_status_card.html.erb +++ b/app/views/lotteries/entrant_service_details/_service_form_status_card.html.erb @@ -7,7 +7,9 @@
    Status
    + <%= service_form_status_with_icon(presenter.__getobj__) %> +
    diff --git a/app/views/lottery_entrants/_service_completed_form.html.erb b/app/views/lottery_entrants/_service_completed_form.html.erb deleted file mode 100644 index ec61221c2..000000000 --- a/app/views/lottery_entrants/_service_completed_form.html.erb +++ /dev/null @@ -1,8 +0,0 @@ -<%= form_with(model: [organization, lottery, entrant], html: { method: :patch, data: { controller: "form-auto-submit" } }) do |f| %> -
    - <%= f.text_field :service_completed_date, - placeholder: "mm/dd/yyyy", - id: dom_id(entrant, :service_completed_date_input), - value: (l(entrant.service_completed_date, format: :default_full_year) if entrant.service_completed?) %> -
    -<% end %> diff --git a/app/views/lottery_entrants/_service_completed_indicator.html.erb b/app/views/lottery_entrants/_service_completed_indicator.html.erb deleted file mode 100644 index 3eaf85002..000000000 --- a/app/views/lottery_entrants/_service_completed_indicator.html.erb +++ /dev/null @@ -1,5 +0,0 @@ -<%= content_tag(:div, id: dom_id(entrant, :service_completed_indicator)) do %> - <%= entrant.service_completed? ? - fa_icon("circle-check", type: :solid, class: "text-success") : - fa_icon("circle-xmark", type: :regular, class: "text-danger") %> -<% end %> diff --git a/app/views/lottery_entrants/_service_status_indicator.html.erb b/app/views/lottery_entrants/_service_status_indicator.html.erb new file mode 100644 index 000000000..be0fbacb8 --- /dev/null +++ b/app/views/lottery_entrants/_service_status_indicator.html.erb @@ -0,0 +1,5 @@ +<%# locals: (entrant:) %> + +<%= content_tag(:div, id: dom_id(entrant, :service_status_indicator)) do %> + <%= service_form_status_with_icon(entrant.service_detail) %> +<% end %> From 4059578d6ab886a5092e255e61fa514154a388eb Mon Sep 17 00:00:00 2001 From: moveson Date: Thu, 19 Dec 2024 16:57:39 -0700 Subject: [PATCH 4/5] Fix specs --- app/views/lottery_entrants/update.turbo_stream.erb | 4 ++-- spec/system/lotteries/withdraw_entrants_spec.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/lottery_entrants/update.turbo_stream.erb b/app/views/lottery_entrants/update.turbo_stream.erb index ea299c68e..26eb4ed1c 100644 --- a/app/views/lottery_entrants/update.turbo_stream.erb +++ b/app/views/lottery_entrants/update.turbo_stream.erb @@ -1,5 +1,5 @@ -<%= turbo_stream.replace dom_id(@lottery_entrant, :service_completed_indicator), - partial: "service_completed_indicator", +<%= turbo_stream.replace dom_id(@lottery_entrant, :service_status_indicator), + partial: "service_status_indicator", locals: { entrant: @lottery_entrant } %> <%= turbo_stream.replace dom_id(@lottery_entrant), diff --git a/spec/system/lotteries/withdraw_entrants_spec.rb b/spec/system/lotteries/withdraw_entrants_spec.rb index 22f3d5367..0b49ab744 100644 --- a/spec/system/lotteries/withdraw_entrants_spec.rb +++ b/spec/system/lotteries/withdraw_entrants_spec.rb @@ -48,7 +48,7 @@ input = page.find("##{dom_id(entrant, :service_completed_date_input)}") input.set("05/15/2023") input.native.send_keys(:tab) - within(page.find("##{dom_id(entrant, :service_completed_indicator)}")) do + within(page.find("##{dom_id(entrant, :service_status_indicator)}")) do expect(page).to have_css("i.fa-circle-check") end end.to change { entrant.reload.service_completed_date }.from(nil).to("2023-05-15".to_date) @@ -63,7 +63,7 @@ input = page.find("##{dom_id(entrant, :service_completed_date_input)}") input.set("") input.native.send_keys(:tab) - within(page.find("##{dom_id(entrant, :service_completed_indicator)}")) do + within(page.find("##{dom_id(entrant, :service_status_indicator)}")) do expect(page).to have_css("i.fa-circle-xmark") end end.to change { entrant.reload.service_completed_date }.from("2023-05-15".to_date).to(nil) From 27f7c940c8677a5ea78d9fe7060d13523a3ac173 Mon Sep 17 00:00:00 2001 From: moveson Date: Thu, 19 Dec 2024 17:05:06 -0700 Subject: [PATCH 5/5] Don't show service status for withdrawn entrants --- app/views/lottery_entrants/_service_status_indicator.html.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/lottery_entrants/_service_status_indicator.html.erb b/app/views/lottery_entrants/_service_status_indicator.html.erb index be0fbacb8..7bf4d03f9 100644 --- a/app/views/lottery_entrants/_service_status_indicator.html.erb +++ b/app/views/lottery_entrants/_service_status_indicator.html.erb @@ -1,5 +1,7 @@ <%# locals: (entrant:) %> <%= content_tag(:div, id: dom_id(entrant, :service_status_indicator)) do %> - <%= service_form_status_with_icon(entrant.service_detail) %> + <% unless entrant.withdrawn? %> + <%= service_form_status_with_icon(entrant.service_detail) %> + <% end %> <% end %>