Skip to content

Commit

Permalink
Convert sponsor counts to integers for accurate calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Nov 26, 2024
1 parent 0332b5c commit 0eed13e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ def scrape_sponsored_page
end

c4 = doc.at('h4:contains("Current sponsors")')
current_sponsors = c4&.at('span.Counter')&.text&.delete(',') || 0
current_sponsors = c4&.at('span.Counter')&.text&.delete(',')&.to_i || 0

p4 = doc.at('h4:contains("Past sponsors")') || doc.at('h5:contains("Past sponsors")')
past_sponsors = p4&.at('span.Counter')&.text&.delete(',') || 0
past_sponsors = p4&.at('span.Counter')&.text&.delete(',')&.to_i || 0

if current_sponsors.zero? && past_sponsors.zero?
sponsor_summary = doc.at_css('p.f3-light.color-fg-muted.mb-3')&.text&.strip
Expand Down

0 comments on commit 0eed13e

Please sign in to comment.