Skip to content

Commit aae60ca

Browse files
committed
問題環境取得のチェックがルールに合っていないのを修正した
1 parent 002bba4 commit aae60ca

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class ProblemEnvironmentAlreadyAssigned < GraphQL::ExecutionError
2-
def initialize(team, problem_id)
3-
super("team(#{team.id}) has already assigned problem environment to problem(#{problem_id})")
2+
def initialize(team)
3+
super("team(#{team.id}) has already assigned problem environment")
44
end
55
end

api/app/graphql/mutations/acquire_problem_environment.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ def resolve(problem_id:, silent:)
2222
return { problem_environments: nil }
2323
end
2424

25-
# NOTE: ここはトランザクション外なので、同時に2つのリクエストが来たときは、ここで引っかからない
26-
if ProblemEnvironment.exists?(problem_id: problem_id, team: self.current_team!, status: 'UNDER_CHALLENGE')
27-
raise ProblemEnvironmentAlreadyAssigned.new(self.current_team!, problem_id)
25+
# トランザクション外なので、同時にリクエストされた場合、同時に問題環境が作成される可能性がある
26+
if ProblemEnvironment.exists?(team: self.current_team!, status: 'UNDER_CHALLENGE')
27+
raise ProblemEnvironmentAlreadyAssigned, self.current_team!
2828
end
2929

3030
# すでに割り当てられた問題環境がない場合に新しい環境を gateway に作らせる

0 commit comments

Comments
 (0)