Skip to content

Commit

Permalink
skip teams with missing data
Browse files Browse the repository at this point in the history
Instead of crashing when we receive HTML with 503s, we should skip these teams and update their rosters next time.
  • Loading branch information
razumau committed May 28, 2023
1 parent 96e2abc commit 89b1d9e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fetchers/base_rosters.rb
Expand Up @@ -38,7 +38,11 @@ def fetch_rosters(ids)
end

def present_rosters(hash)
hash.flat_map do |_, players|
hash.flat_map do |team_id, players|
if players.is_a? String
puts "Malformed data for team #{team_id}, skipping it"
next
end
players.flat_map do |player|
{
team_id: player['idteam'],
Expand All @@ -48,6 +52,6 @@ def present_rosters(hash)
end_date: player['dateRemoved']
}
end
end
end.compact
end
end

0 comments on commit 89b1d9e

Please sign in to comment.