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:
funman300
2026-08-21 19:55:46 +00:00
parent 1a6355cad5
commit 09db5413cd
3 changed files with 31 additions and 1 deletions
+25
View File
@@ -1113,6 +1113,9 @@ pub struct EmitSummary {
pub content_pack: std::path::PathBuf,
pub host_catalog: 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 catalog_entries: usize,
pub supported_instances: usize,
@@ -1242,6 +1245,27 @@ pub fn emit_content(
let host_catalog = content_dir.join("fifa17-production-catalog.json");
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) ----
let supported: Vec<serde_json::Value> = report
.definitions
@@ -1351,6 +1375,7 @@ pub fn emit_content(
Ok(EmitSummary {
content_pack,
host_catalog,
reclassify,
manifest: manifest_path,
definitions: report.definitions.supported.len(),
catalog_entries: report.definitions.supported.len() + non_player_definitions,
+5
View File
@@ -123,6 +123,11 @@ fn run() -> Result<ExitCode> {
sum.supported_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!(
" non-player : {} definition(s), {} instance(s) (consumable/staff)",
sum.non_player_definitions, sum.non_player_instances