Commit f309dace authored by nanahira's avatar nanahira

improve

parent bd7cbbab
Pipeline #598 passed with stages
in 6 minutes and 28 seconds
...@@ -54,15 +54,23 @@ function makeMatch(team1: Team, team2: Team): RenderData { ...@@ -54,15 +54,23 @@ function makeMatch(team1: Team, team2: Team): RenderData {
duels.push([memberLists[0][i], memberLists[1][i]]); duels.push([memberLists[0][i], memberLists[1][i]]);
} }
return { return {
teamNames: [team1.name, team2.name], teamNames: [team1.name, team2.name].map(n => n.toUpperCase()),
timeString: moment().format("YYYY.MM.DD"), timeString: moment().format("YYYY.MM.DD"),
duels duels
} }
} }
for (let match of config.matches) { for (let match of config.matches) {
const team1 = _.find(config.teams, t => t.name === match.team1); const team1 = _.find(config.teams, t => t.name.toUpperCase() === match.team1.toUpperCase());
const team2 = _.find(config.teams, t => t.name === match.team2); if (!team1) {
console.error(`Missing team ${match.team1}`);
continue;
}
const team2 = _.find(config.teams, t => t.name.toUpperCase() === match.team2.toUpperCase());
if (!team2) {
console.error(`Missing team ${match.team2}`);
continue;
}
const data = makeMatch(team1, team2); const data = makeMatch(team1, team2);
const renderedData = jinja.render(config.template, data); const renderedData = jinja.render(config.template, data);
console.log(renderedData); console.log(renderedData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment