Skip to content

Commit 6846083

Browse files
authored
fix download booster rules to have empty entires for all colors AND colorless (#1375)
1 parent 342df3b commit 6846083

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

scripts/download_booster_rules.js

+12-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ const {getBoosterRulesVersion, getCardByUuid, getSet, saveBoosterRules} = requir
55
const URL = "https://raw.githubusercontent.com/taw/magic-sealed-data/master/sealed_basic_data.json";
66
const REPO_URL = "https://api.github.com/repos/taw/magic-sealed-data/git/refs/heads/master";
77

8+
const CardsByColorInitial = () => ({
9+
W: [],
10+
B: [],
11+
U: [],
12+
R: [],
13+
G: [],
14+
c: []
15+
});
16+
817
async function fetch() {
918
logger.info("Checking boosterRules repository");
1019
const repo = await axios.get(REPO_URL);
@@ -37,17 +46,17 @@ async function fetch() {
3746
try {
3847
const {uuid, colorIdentity, type} = getCard(cardCode);
3948
if (type === "Land" || colorIdentity.length === 0) {
40-
(acc["c"] = acc["c"] || []).push(uuid);
49+
acc["c"].push(uuid);
4150
} else {
4251
colorIdentity.forEach((color) => {
43-
(acc[color] = acc[color] || []).push(uuid);
52+
acc[color].push(uuid);
4453
});
4554
}
4655
} catch(err) {
4756
logger.warn(cardCode + " doesn't match any card");
4857
}
4958
return acc;
50-
},{})
59+
}, CardsByColorInitial())
5160
};
5261
return acc;
5362
}, {}),

0 commit comments

Comments
 (0)