feat(import-fifa17): emit the Core reclassify request from the catalog
The importer already knows every definition's kind, so it writes the mapping Core needs to correct a club imported before the taxonomy existed. Applied to the real 1989-item club: 20 rows corrected (17 consumables + 3 staff), 1966 players already right, 0 unmatched definitions.
This commit is contained in:
+1
-1
Submodule openfut-core updated: 36bc594924...c896545cf0
@@ -1113,6 +1113,9 @@ pub struct EmitSummary {
|
|||||||
pub content_pack: std::path::PathBuf,
|
pub content_pack: std::path::PathBuf,
|
||||||
pub host_catalog: std::path::PathBuf,
|
pub host_catalog: std::path::PathBuf,
|
||||||
pub manifest: std::path::PathBuf,
|
pub manifest: std::path::PathBuf,
|
||||||
|
/// Core `reclassify` request correcting the content_kind of rows imported
|
||||||
|
/// before the taxonomy existed.
|
||||||
|
pub reclassify: std::path::PathBuf,
|
||||||
pub definitions: usize,
|
pub definitions: usize,
|
||||||
pub catalog_entries: usize,
|
pub catalog_entries: usize,
|
||||||
pub supported_instances: usize,
|
pub supported_instances: usize,
|
||||||
@@ -1242,6 +1245,27 @@ pub fn emit_content(
|
|||||||
let host_catalog = content_dir.join("fifa17-production-catalog.json");
|
let host_catalog = content_dir.join("fifa17-production-catalog.json");
|
||||||
write_json_pretty(&host_catalog, &catalog)?;
|
write_json_pretty(&host_catalog, &catalog)?;
|
||||||
|
|
||||||
|
// ---- Core reclassify request (content_kind of already-imported rows) ----
|
||||||
|
// A profile import is once-only, so a club imported before the taxonomy
|
||||||
|
// existed still records its coaches, kits and consumables as players. Core
|
||||||
|
// cannot derive the right kind (it is FIFA17 taxonomy), so hand it the
|
||||||
|
// mapping. Players are included too: a definition that was mis-set stays
|
||||||
|
// correctable, and a rerun changes nothing.
|
||||||
|
let assignments: Vec<serde_json::Value> = report
|
||||||
|
.definitions
|
||||||
|
.supported
|
||||||
|
.iter()
|
||||||
|
.map(|d| serde_json::json!({ "card_id": d.card_id, "content_kind": "player" }))
|
||||||
|
.chain(report.non_player.supported.iter().map(|d| {
|
||||||
|
serde_json::json!({ "card_id": d.card_id, "content_kind": d.kind.as_str() })
|
||||||
|
}))
|
||||||
|
.collect();
|
||||||
|
let reclassify = content_dir.join("fifa17-reclassify.json");
|
||||||
|
write_json_pretty(
|
||||||
|
&reclassify,
|
||||||
|
&serde_json::json!({ "game_id": "fifa17", "assignments": assignments }),
|
||||||
|
)?;
|
||||||
|
|
||||||
// ---- PRIVATE: import manifest (wire ids + deferred set) ----
|
// ---- PRIVATE: import manifest (wire ids + deferred set) ----
|
||||||
let supported: Vec<serde_json::Value> = report
|
let supported: Vec<serde_json::Value> = report
|
||||||
.definitions
|
.definitions
|
||||||
@@ -1351,6 +1375,7 @@ pub fn emit_content(
|
|||||||
Ok(EmitSummary {
|
Ok(EmitSummary {
|
||||||
content_pack,
|
content_pack,
|
||||||
host_catalog,
|
host_catalog,
|
||||||
|
reclassify,
|
||||||
manifest: manifest_path,
|
manifest: manifest_path,
|
||||||
definitions: report.definitions.supported.len(),
|
definitions: report.definitions.supported.len(),
|
||||||
catalog_entries: report.definitions.supported.len() + non_player_definitions,
|
catalog_entries: report.definitions.supported.len() + non_player_definitions,
|
||||||
|
|||||||
@@ -123,6 +123,11 @@ fn run() -> Result<ExitCode> {
|
|||||||
sum.supported_instances,
|
sum.supported_instances,
|
||||||
sum.deferred_instances
|
sum.deferred_instances
|
||||||
);
|
);
|
||||||
|
println!(
|
||||||
|
" reclassify : {} (run `openfut-core reclassify <file>` to correct \
|
||||||
|
content_kind on a club imported before the taxonomy existed)",
|
||||||
|
sum.reclassify.display()
|
||||||
|
);
|
||||||
println!(
|
println!(
|
||||||
" non-player : {} definition(s), {} instance(s) (consumable/staff)",
|
" non-player : {} definition(s), {} instance(s) (consumable/staff)",
|
||||||
sum.non_player_definitions, sum.non_player_instances
|
sum.non_player_definitions, sum.non_player_instances
|
||||||
|
|||||||
Reference in New Issue
Block a user