Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 予選を同時に生成 #826

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions packages/kcms/src/match/service/generatePre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ export class GeneratePreMatchService {
) {}

async handle(departmentType: DepartmentType): Promise<Result.Result<Error, PreMatch[]>> {
if (!config.match.pre.course[departmentType]) {
if (!config.match.pre.course[departmentType].length) {
return Result.err(new Error('DepartmentType is not defined'));
}
const pair = await this.makePairs(departmentType);
return await this.makeMatches(pair);
const matches = new Map();
for (const e of config.departmentTypes) {
if (config.match.pre.course[e].length) {
const pair = await this.makePairs(e);
const match = await this.makeMatches(pair);
matches.set(e, match);
}
}
return matches.get(departmentType);
}

private async makeMatches(
Expand Down
Loading