Update character parser to use correct vars
This commit is contained in:
parent
f50142054c
commit
919625feb7
1 changed files with 5 additions and 5 deletions
|
|
@ -35,10 +35,10 @@ class CharacterParser
|
||||||
|
|
||||||
@character.wiki_en = redirect
|
@character.wiki_en = redirect
|
||||||
if @character.save!
|
if @character.save!
|
||||||
ap "Saved new wiki_en value for #{@granblue_id}: #{redirect}" if @debug
|
ap "Saved new wiki_en value for #{@character.granblue_id}: #{redirect}" if @debug
|
||||||
redirect
|
redirect
|
||||||
else
|
else
|
||||||
ap "Unable to save new wiki_en value for #{@granblue_id}: #{redirect}" if @debug
|
ap "Unable to save new wiki_en value for #{@character.granblue_id}: #{redirect}" if @debug
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -46,7 +46,7 @@ class CharacterParser
|
||||||
# Handle the response from the wiki if the response is successful
|
# Handle the response from the wiki if the response is successful
|
||||||
# If the save flag is set, it will persist the data to the database
|
# If the save flag is set, it will persist the data to the database
|
||||||
def handle_fetch_success(response, save)
|
def handle_fetch_success(response, save)
|
||||||
ap "#{@granblue_id}: Successfully fetched info for #{@character.wiki_en}" if @debug
|
ap "#{@character.granblue_id}: Successfully fetched info for #{@character.wiki_en}" if @debug
|
||||||
extracted = parse_string(response)
|
extracted = parse_string(response)
|
||||||
info = parse(extracted)
|
info = parse(extracted)
|
||||||
persist(info) if save
|
persist(info) if save
|
||||||
|
|
@ -180,8 +180,8 @@ class CharacterParser
|
||||||
end
|
end
|
||||||
|
|
||||||
# Converts proficiencies from a string to a hash
|
# Converts proficiencies from a string to a hash
|
||||||
def proficiencies_from_hash(weapon)
|
def proficiencies_from_hash(character)
|
||||||
weapon.to_s.split(',').map.with_index do |prof, i|
|
character.to_s.split(',').map.with_index do |prof, i|
|
||||||
{ "proficiency#{i + 1}" => GranblueWiki.proficiencies[prof] }
|
{ "proficiency#{i + 1}" => GranblueWiki.proficiencies[prof] }
|
||||||
end.reduce({}, :merge)
|
end.reduce({}, :merge)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue