rename suggestions to parsed_data in batch preview
- rename SuggestionParser → WikiDataParser - change response key from suggestions → parsed_data
This commit is contained in:
parent
53cb15fa27
commit
95dc3c441f
2 changed files with 12 additions and 12 deletions
|
|
@ -10,7 +10,7 @@ module BatchPreviewable
|
||||||
# @param wiki_page [String] The wiki page name to fetch
|
# @param wiki_page [String] The wiki page name to fetch
|
||||||
# @param entity_type [Symbol] The type of entity (:character, :weapon, :summon)
|
# @param entity_type [Symbol] The type of entity (:character, :weapon, :summon)
|
||||||
# @param wiki_raw [String, nil] Pre-fetched wiki text (from client-side fetch)
|
# @param wiki_raw [String, nil] Pre-fetched wiki text (from client-side fetch)
|
||||||
# @return [Hash] Preview data including status, suggestions, and errors
|
# @return [Hash] Preview data including status, parsed_data, and errors
|
||||||
def process_wiki_preview(wiki_page, entity_type, wiki_raw: nil)
|
def process_wiki_preview(wiki_page, entity_type, wiki_raw: nil)
|
||||||
result = {
|
result = {
|
||||||
wiki_page: wiki_page,
|
wiki_page: wiki_page,
|
||||||
|
|
@ -39,22 +39,22 @@ module BatchPreviewable
|
||||||
|
|
||||||
result[:wiki_raw] = wiki_text
|
result[:wiki_raw] = wiki_text
|
||||||
|
|
||||||
# Parse suggestions based on entity type
|
# Parse data from wiki text based on entity type
|
||||||
suggestions = case entity_type
|
parsed_data = case entity_type
|
||||||
when :character
|
when :character
|
||||||
Granblue::Parsers::SuggestionParser.parse_character(wiki_text)
|
Granblue::Parsers::WikiDataParser.parse_character(wiki_text)
|
||||||
when :weapon
|
when :weapon
|
||||||
Granblue::Parsers::SuggestionParser.parse_weapon(wiki_text)
|
Granblue::Parsers::WikiDataParser.parse_weapon(wiki_text)
|
||||||
when :summon
|
when :summon
|
||||||
Granblue::Parsers::SuggestionParser.parse_summon(wiki_text)
|
Granblue::Parsers::WikiDataParser.parse_summon(wiki_text)
|
||||||
end
|
end
|
||||||
|
|
||||||
result[:granblue_id] = suggestions[:granblue_id] if suggestions[:granblue_id].present?
|
result[:granblue_id] = parsed_data[:granblue_id] if parsed_data[:granblue_id].present?
|
||||||
result[:suggestions] = suggestions
|
result[:parsed_data] = parsed_data
|
||||||
|
|
||||||
# Queue image download if we have a granblue_id
|
# Queue image download if we have a granblue_id
|
||||||
if suggestions[:granblue_id].present?
|
if parsed_data[:granblue_id].present?
|
||||||
result[:image_status] = queue_image_download(suggestions[:granblue_id], entity_type)
|
result[:image_status] = queue_image_download(parsed_data[:granblue_id], entity_type)
|
||||||
else
|
else
|
||||||
result[:image_status] = 'no_id'
|
result[:image_status] = 'no_id'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
|
|
||||||
module Granblue
|
module Granblue
|
||||||
module Parsers
|
module Parsers
|
||||||
# SuggestionParser extracts structured suggestions from wiki text
|
# WikiDataParser extracts structured data from wiki text
|
||||||
# for use in batch entity import flows
|
# for use in batch entity import flows
|
||||||
class SuggestionParser
|
class WikiDataParser
|
||||||
# Parse character wiki text into suggestion fields
|
# Parse character wiki text into suggestion fields
|
||||||
def self.parse_character(wiki_text)
|
def self.parse_character(wiki_text)
|
||||||
return {} if wiki_text.blank?
|
return {} if wiki_text.blank?
|
||||||
Loading…
Reference in a new issue