mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-30 11:04:56 +00:00
Fixed bug in baumspage importer. Trailing (season loss) array item was shifted if it was blank.
This commit is contained in:
@@ -28,7 +28,8 @@ class BaumspageRosterImport
|
|||||||
|
|
||||||
def parse_starter(line)
|
def parse_starter(line)
|
||||||
extra = false
|
extra = false
|
||||||
wrestler_array = line.split(',')
|
# ,-1 allows the last field in split to be blank
|
||||||
|
wrestler_array = line.split(',',-1)
|
||||||
wrestler_losses_array_spot = wrestler_array.size - 1
|
wrestler_losses_array_spot = wrestler_array.size - 1
|
||||||
wrestler_wins_array_spot = wrestler_array.size - 2
|
wrestler_wins_array_spot = wrestler_array.size - 2
|
||||||
last_criteria_array_spot = wrestler_wins_array_spot - 1
|
last_criteria_array_spot = wrestler_wins_array_spot - 1
|
||||||
@@ -43,7 +44,8 @@ class BaumspageRosterImport
|
|||||||
|
|
||||||
def parse_extra(line)
|
def parse_extra(line)
|
||||||
extra = true
|
extra = true
|
||||||
wrestler_array = line.split(',')
|
# ,-1 allows the last field in split to be blank
|
||||||
|
wrestler_array = line.split(',',-1)
|
||||||
wrestler_losses_array_spot = wrestler_array.size - 1
|
wrestler_losses_array_spot = wrestler_array.size - 1
|
||||||
wrestler_wins_array_spot = wrestler_array.size - 2
|
wrestler_wins_array_spot = wrestler_array.size - 2
|
||||||
if wrestler_array[1]
|
if wrestler_array[1]
|
||||||
@@ -52,6 +54,12 @@ class BaumspageRosterImport
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_wrestler(name,weight,criteria,season_win,season_loss,extra)
|
def create_wrestler(name,weight,criteria,season_win,season_loss,extra)
|
||||||
|
if season_win == ""
|
||||||
|
season_win = 0
|
||||||
|
end
|
||||||
|
if season_loss == ""
|
||||||
|
season_loss = 0
|
||||||
|
end
|
||||||
wrestler = Wrestler.new
|
wrestler = Wrestler.new
|
||||||
wrestler.name = name
|
wrestler.name = name
|
||||||
wrestler.school_id = @school.id
|
wrestler.school_id = @school.id
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ Some Guy
|
|||||||
guy = @school.wrestlers.select{|w| w.name == "Another Guy"}.first
|
guy = @school.wrestlers.select{|w| w.name == "Another Guy"}.first
|
||||||
assert guy.season_win == 5
|
assert guy.season_win == 5
|
||||||
assert guy.season_loss == 7
|
assert guy.season_loss == 7
|
||||||
|
guy5 = @school.wrestlers.select{|w| w.name == "Another Guy5"}.first
|
||||||
|
assert guy5.season_win == 0
|
||||||
|
assert guy5.season_loss == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user