Skip to content

Commit

Permalink
Remove most references to service_completed_date
Browse files Browse the repository at this point in the history
  • Loading branch information
moveson committed Dec 19, 2024
1 parent 95fc520 commit 5c543c9
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 32 deletions.
1 change: 0 additions & 1 deletion app/madmin/resources/lottery_entrant_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class LotteryEntrantResource < Madmin::Resource
attribute :pre_selected
attribute :external_id
attribute :withdrawn
attribute :service_completed_date

# Associations
attribute :division
Expand Down
6 changes: 6 additions & 0 deletions app/models/lottery_entrant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion app/parameters/lottery_entrant_parameters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def self.permitted
:lottery_division_id,
:number_of_tickets,
:pre_selected,
:service_completed_date,
:state_code,
:withdrawn,
]
Expand Down
2 changes: 1 addition & 1 deletion app/views/lotteries/_entrant_for_results.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<li><%= "#{entrant.name} (#{entrant.flexible_geolocation})" %>
<% if !entrant.withdrawn? && entrant.service_completed_date? %>
<% if !entrant.withdrawn? && entrant.service_completed? %>
<span class="text-success px-2"><%= fa_icon("circle-check", text: "Service Form Received", type: :solid, class: "text-success") %></span>
<% end %>
</li>
7 changes: 0 additions & 7 deletions app/views/lottery_entrants/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@
</div>
</div>

<div class="row">
<div class="mb-3 col-md-2">
<%= f.label :service_completed_date, class: "mb-1" %>
<%= f.text_field :service_completed_date, class: "form-control", placeholder: "mm/dd/yyyy" %>
</div>
</div>

<br/>
<div class="row">
<div class="col">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?) %>
</div>
<% end %>
Original file line number Diff line number Diff line change
@@ -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 %>
18 changes: 0 additions & 18 deletions spec/fixtures/lottery_entrants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -304,4 +287,3 @@ lottery_entrant_0018:
pre_selected: false
external_id:
withdrawn:
service_completed_date:
4 changes: 2 additions & 2 deletions spec/system/lotteries/withdraw_entrants_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 5c543c9

Please sign in to comment.