diff --git a/library/packet/countrySheet.js b/library/packet/countrySheet.js index c0243e71f..65b89377a 100644 --- a/library/packet/countrySheet.js +++ b/library/packet/countrySheet.js @@ -1,7 +1,8 @@ /** * countrySheet.js — a country's map sheet, GENERATED in the browser at the click. * - * SHARED (@map/packet/countrySheet.js). Its caller is the regions dashboard's regions-list. + * SHARED (@map/packet/countrySheet.js). Its callers are the regions dashboard's regions-list and the + * Country Posters wall (country-poster-wall.vue), which used to define its own inline copy. * * ⚠ THE MOVE HERE WAS NEVER FINISHED, and it cost a real defect. This module's comment used to claim * two consumers -- the country-poster wall and -- and a CENSUS of the tree found @@ -14,7 +15,8 @@ * `country` without a region -- so countryRegionColor(undefined) returned the old flat teal and * warned. The same country then printed HUED from Country Posters and TEAL from the Regions tab, * which is exactly the "two different posters for one country" the hue change exists to refuse. - * The copy is deleted and regions-list imports this. Do not re-copy it: a duplicate of this file is + * The copy is deleted, and regions-list and the wall both import this (check:country-sheet-one-path + * refuses a caller that draws a country sheet any other way). Do not re-copy it: a duplicate of this file is * indistinguishable from it until one of them is edited, and then it is a silent divergence. * * The print standard is generate, store only previews: no country sheet is shipped, and none should @@ -52,12 +54,16 @@ * not introduced by the one-definition change: the plugin-local copy regions-list used before it * passed no series either. The wall was never affected because it computes its own. * - * Returns undefined when the item has no sheet tier, so a row without a poster keeps the renderer's - * own default rather than a fabricated position. + * Returns undefined when the item is not in the list (a host's country with no poster), so that row + * keeps the renderer's own default rather than a fabricated position. + * + * A null sheet is a tier too: India (sheet null, too many groups for any paper size) is its own + * 1-of-1 series. Skipping it printed "map 1 of 0" on India's packet page 1 from the Regions tab + * while the wall's own copy printed "map 1 of 1" -- the two paths disagreeing again. */ export function seriesFor(countries, item) { - if (!item || !item.sheet || !Array.isArray(countries)) return undefined - const tier = countries.filter((x) => x.sheet === item.sheet) + if (!item || !Array.isArray(countries)) return undefined + const tier = countries.filter((x) => (x.sheet ?? null) === (item.sheet ?? null)) const index = tier.findIndex((x) => x.id === item.id) + 1 if (!index) return undefined return { totalGroups: tier.reduce((a, x) => a + (x.count || 0), 0), totalLists: tier.length, index }