File tree 3 files changed +16
-6
lines changed
3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -180,7 +180,8 @@ def __init__(self, submission: Submission):
180
180
print (f"substitude { codepath } with user implemented" )
181
181
wfp .write (filecontent )
182
182
183
- def judge (self ):
183
+ def judge (self ) -> bool :
184
+ # return True if grade is 100
184
185
tester_path = join (self .sub_dirpath , TESTER_NAME )
185
186
if not exists (tester_path ):
186
187
raise Exception ("running submission: tester {} not exists" .format (tester_path ))
@@ -189,7 +190,7 @@ def judge(self):
189
190
if res == TestResult .Timeout :
190
191
self .sub .result = JudgeStatus .PROGRAM_TIMEOUT
191
192
self .sub .save ()
192
- return
193
+ return False
193
194
elif res == TestResult .Error :
194
195
raise Exception ("Running test proc has some problem" )
195
196
@@ -238,3 +239,6 @@ def judge(self):
238
239
else :
239
240
self .sub .result = JudgeStatus .SOME_PASSED
240
241
self .sub .save ()
242
+ if grade == 100 :
243
+ return True
244
+ return False
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ class Problem(models.Model):
26
26
# code segment filenames to be substituded
27
27
description = RichTextField ()
28
28
# hint = RichTextField(null=True)
29
- languages = JSONField (default = ["python " ])
29
+ languages = JSONField (default = ["Python3 " ])
30
30
vm_num = models .IntegerField (default = 1 )
31
31
port_num = models .JSONField (default = list )
32
32
code_num = models .IntegerField ()
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ def check_contest_permission(self, request):
68
68
):
69
69
return self .error ("Your IP is not allowed in this contest" )
70
70
71
- @validate_serializer (CreateSubmissionSerializer )
71
+ # @validate_serializer(CreateSubmissionSerializer)
72
72
@login_required
73
73
def post (self , request ):
74
74
# print(request.data)
@@ -124,8 +124,14 @@ def post(self, request):
124
124
125
125
# execute judge task in dramatiq
126
126
# local_judge_task.send(submission.id, problem._id)
127
- tester = SubmissionTester (submission )
128
- tester .judge ()
127
+
128
+ problem .submission_number += 1
129
+ try :
130
+ if SubmissionTester (submission ).judge ():
131
+ problem .accepted_number += 1
132
+ except Exception as e :
133
+ self .error (str (e ))
134
+ problem .save ()
129
135
130
136
if hide_id :
131
137
return self .success ()
You can’t perform that action at this time.
0 commit comments