diff --git a/app/models/player.rb b/app/models/player.rb index 525afa5..27e1e20 100644 --- a/app/models/player.rb +++ b/app/models/player.rb @@ -8,6 +8,16 @@ def only_have_nationality self.place_of_birth = "" end + def removes_pob_region + # avoid entries where place of birth is deliberately set to empty string because TransferMarkt doesn't provide one to us yet + if self.place_of_birth == "" + return + else + self.place_of_birth = self.place_of_birth.split(',')[0] + self.save + end + end + def strip_nationality deprecated_nations = ["Jugoslawien (SFR)","CSSR","UDSSR","Yugoslavia (Republic)"] # we can update nationality from another source diff --git a/lib/tasks/get_gps_coords.rake b/lib/tasks/get_gps_coords.rake index 5ecb1ce..242a8c5 100644 --- a/lib/tasks/get_gps_coords.rake +++ b/lib/tasks/get_gps_coords.rake @@ -16,7 +16,9 @@ namespace :app do start = Time.now club_players.each_with_index do |player, i| + player.removes_pob_region pob = player.place_of_birth + player.strip_nationality # replaces specified nationalities with "" nat = player.nationality