Skip to content

Commit

Permalink
feat: 16번 문제 채점 로직 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
flydog98 authored and LuizyHub committed Dec 3, 2023
1 parent 29653fd commit dfa36d5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/backend/src/quiz-wizard/magic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,12 @@ export class Magic {

return stdoutData;
}

async getNowBranch(container: string): Promise<string> {
const { stdoutData } = await this.sshService.executeSSHCommand(
`docker exec -u quizzer -w /home/quizzer/quiz ${container} sh -c "git rev-parse --abbrev-ref HEAD"`,
);

return stdoutData.trim();
}
}
5 changes: 5 additions & 0 deletions packages/backend/src/quiz-wizard/quiz-wizard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class QuizWizardService {
12: (containerId: string) => this.checkCondition12(containerId),
13: (containerId: string) => this.checkCondition13(containerId),
15: (containerId: string) => this.checkCondition15(containerId),
16: (containerId: string) => this.checkCondition16(containerId),
};

async submit(containerId: string, quizId: number) {
Expand Down Expand Up @@ -251,4 +252,8 @@ upstream /upstream (push)

return true;
}

async checkCondition16(containerId: string): Promise<boolean> {
return (await this.magic.getNowBranch(containerId)) === 'feat/somethingA';
}
}

0 comments on commit dfa36d5

Please sign in to comment.