Skip to content

Commit a1a23ce

Browse files
committed
Remove legacy GetData
1 parent 327e851 commit a1a23ce

12 files changed

+14
-49
lines changed

.rubocop.yml

-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,6 @@ AllCops:
306306
- 'app/jobs/webhook_transmit_job.rb'
307307
- 'app/jobs/stripe_account_create_job.rb'
308308
- 'app/legacy_lib/import_civicrm_payments.rb'
309-
- 'app/legacy_lib/get_data.rb'
310309
- 'app/legacy_lib/name_copy_naming_algorithm.rb'
311310
- 'app/legacy_lib/health_report.rb'
312311
- 'app/legacy_lib/qexpr_query_chunker.rb'

app/legacy_lib/create_stripe_account.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
module CreateStripeAccount
88
def self.for_nonprofit(user, params)
9-
fst_name, lst_name = Format::Name.split_full(GetData.chain(user, :profile, :name))
9+
fst_name, lst_name = Format::Name.split_full(user&.profile&.name))
1010
Stripe::Account.create(
1111
managed: true,
1212
email: params[:email],

app/legacy_lib/get_data.rb

-34
This file was deleted.

app/legacy_lib/insert_charge.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ def self.with_stripe(data)
115115
charge.amount = data[:amount]
116116
charge.fee = fee
117117

118-
charge.stripe_charge_id = GetData.chain(stripe_charge, :id)
118+
charge.stripe_charge_id = stripe_charge&.id
119119
charge.failure_message = failure_message
120-
charge.status = GetData.chain(stripe_charge, :paid) ? 'pending' : 'failed'
120+
charge.status = stripe_charge&.paid ? 'pending' : 'failed'
121121
charge.card = card
122122
charge.donation = Donation.where('id = ?', data[:donation_id]).first
123123
charge.supporter = supporter

app/models/import_request.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def execute(user)
115115
if table_data['donation'] && table_data['donation']['id']
116116
table_data['offsite_payment'] = Qx.insert_into(:offsite_payments).values(
117117
gross_amount: table_data['donation']['amount'],
118-
check_number: GetData.chain(table_data['offsite_payment'], 'check_number'),
118+
check_number: table_data['offsite_payment'] && table_data['offsite_payment']['check_number'],
119119
kind: table_data['offsite_payment'] && table_data['offsite_payment']['check_number'] ? 'check' : '',
120120
nonprofit_id: nonprofit.id,
121121
supporter_id: table_data['supporter']['id'],

app/views/cards/_fields.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@
5555
placeholder='Postal Code'>
5656
</fieldset>
5757
58-
<input type='hidden' name='profile_id' value='<%= GetData.chain(current_user, :profile, :id) %>'>
58+
<input type='hidden' name='profile_id' value='<%= current_user&.profile&.id%>'>
5959
</div>

app/views/charge_mailer/_payment_receipt.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</tr>
3232
3333
<tr>
34-
<% if GetData.chain(charge.card, :name).present? %>
34+
<% if charge.card&.name.present? %>
3535
<td><strong>Card</strong></td>
3636
<td> <%= charge.card.name %> </td>
3737
<% end %>

app/views/donation_mailer/_donation_payment_table.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
<% if charge %>
8989
<tr>
9090
<td><strong><%= t('donation.payment_id') %></strong></td>
91-
<td> <%= GetData.chain(donation.payment, :id) %></td>
91+
<td> <%= donation.payment&.id %></td>
9292
</tr>
9393
<% end %>
9494

app/views/nonprofits/payments/show.jbuilder

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ json.data do
6060
json.extract! event, :name, :id
6161
json.url event_locateable_url(event)
6262
end
63-
json.levels @payment.tickets.map { |t| "#{GetData.chain(t.ticket_level, :name)} (#{t.quantity}x)" }.join(', ')
63+
json.levels @payment.tickets.map { |t| "#{t.ticket_level&.name} (#{t.quantity}x)" }.join(', ')
6464
json.discount @payment.tickets.map { |t| t.event_discount ? "#{t.event_discount.name} (#{t.event_discount.percent}%)" : nil }.compact.join(', ')
6565
end if @payment&.tickets&.last&.event
6666

app/views/profiles/_donations.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<%= link_to(donation.nonprofit.name, donation.nonprofit.url) %>
2525
</td>
2626
<td> <%= format_date_to_mdY(donation.created_at) %></td>
27-
<td> <%= GetData.chain(donation.card, :name) %> </td>
27+
<td> <%= donation.card&.name %> </td>
2828
</tr>
2929
<% end %>
3030
</tbody>

app/views/ticket_mailer/_tickets.html.erb

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<strong>Ticket Level</strong>
1515
</td>
1616
<td>
17-
<%= GetData.chain(ticket, :ticket_level, :name) != nil ? GetData.chain(ticket, :ticket_level, :name) : 'n/a' %>
17+
<%= ticket&.ticket_level&.name.present? ? ticket&.ticket_level&.name : 'n/a' %>
1818
</td>
1919
</tr>
2020
<tr>
@@ -23,19 +23,19 @@
2323
</tr>
2424
<tr>
2525
<td><strong>Name</strong></td>
26-
<td> <%= GetData.chain(ticket, :supporter, :name) %></td>
26+
<td> <%= ticket&.supporter&.name %></td>
2727
</tr>
2828
<tr>
2929
<td><strong>Email</strong></td>
30-
<td><%= GetData.chain(ticket, :supporter, :email) %></td>
30+
<td><%= ticket&.supporter&.email %></td>
3131
</tr>
3232
<tr>
3333
<td><strong>Ticket ID</strong></td>
3434
<td> <%= ticket.id %></td>
3535
</tr>
3636
<tr>
3737
<td><strong>Comment</strong></td>
38-
<td> <%= GetData.chain(ticket, :donation, :comment) || 'None' %></td>
38+
<td> <%= ticket&.donation&.comment || 'None' %></td>
3939
</tr>
4040
<% if tickets.length != 1 %>
4141
<tr colspan='2'><td><p></p></td></tr>

app/views/ticket_mailer/followup.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<p>
6868
Your payment of $<strong><%= Format::Currency.cents_to_dollars(@charge.amount) %></strong>
6969
for the event <strong><a href='<%= Format::Url.concat(root_url, @event.url) %>'><%= @event.name %></a></strong>
70-
using <strong><%= GetData.chain(@charge, :card, :name) || 'Unknown card' %></strong>
70+
using <strong><%= @charge&.card&.name || 'Unknown card' %></strong>
7171
was successful.
7272
</p><br>
7373

0 commit comments

Comments
 (0)