From d88e1771d253fbeecb4399d3a6d7e407354f69ec Mon Sep 17 00:00:00 2001 From: BoYanZh <32470225+BoYanZh@users.noreply.github.com> Date: Fri, 2 Oct 2020 12:03:05 +0800 Subject: update: add JOJ fail to compile check --- README.md | 2 +- settings.example.py | 3 ++- worker/JOJWorker.py | 15 ++++++++------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0d4e070..10aba6a 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Please modify `JOJ_INFO` for different homework. - [x] At least two days before the group deadline, all students should individually complete all the mandatory tasks and push their work to their personal branch of their group git repository and issue a pull request. Students late for the individual submission must open an issue featuring: (i) apologies to the reviewer, (ii) clear explanations on why the work is late, and (iii) a request for a new deadline fitting the reviewer. The reviewer is allowed to reject the request and should set the deadline based on his/her own schedule. (-0.5 mark) - [ ] A student should provide feedbacks to at least one teammate for each mandatory exercise. Low quality reviews will be ignored. Each student should receive feedbacks on his individual submission. e.g. for a three students group: student1 → student2 → student3 → student1. (-1 mark) -- [ ] The final group submission, done on the master branch of the group repository, should successfully compile or be interpreted. (-1 mark) +- [x] The final group submission, done on the master branch of the group repository, should successfully compile or be interpreted. (-1 mark) - [x] Any group submission that is more than 24 hours late will be rejected. (-2.5 marks) - [x] For each exercise, the final submission must pass at least 25% of the test cases. (-0.25 mark per exercise, up to -0.5) - [x] For a homework the final submission must pass at least 50% of all the test cases. (-0.5 mark) \ No newline at end of file diff --git a/settings.example.py b/settings.example.py index 2d30c1b..c859ac3 100644 --- a/settings.example.py +++ b/settings.example.py @@ -12,7 +12,8 @@ RUBRIC = { "groupFailSubmit": [-2.5, 'group submit absence, -2.5'], "groupUntidy": [-0.25, 'group branch untidy, -0.25'], "jojFailHomework": [-0.5, 'JOJ homework not passed, -0.5'], - "jojFailExercise": [-0.25, 'JOJ exercise not passed, -0.25'] + "jojFailExercise": [-0.25, 'JOJ exercise not passed, -0.25'], + "jojFailCompile": [-1, 'JOJ fail to compile, -1'], } JOJ_INFO = { "lang": diff --git a/worker/JOJWorker.py b/worker/JOJWorker.py index 135a113..1f4fd16 100644 --- a/worker/JOJWorker.py +++ b/worker/JOJWorker.py @@ -54,16 +54,15 @@ class JOJWorker(): "#status > div.section__header > h1 > span:nth-child(2)" )[0].get_text().strip() if status not in ["Waiting", "Compiling", "Fetched", "Running"]: - self.logger.debug(status) break else: time.sleep(1) + if status == "Compile Error": return -1 resultSet = soup.findAll("td", class_="col--status typo") - acCount = 0 - for result in resultSet: - if "Accepted" == result.find_all('span')[1].get_text().strip(): - acCount += 1 - return acCount + return sum([ + "Accepted" == result.find_all('span')[1].get_text().strip() + for result in resultSet + ]) def getProblemResult(self, homeworkID, @@ -121,10 +120,12 @@ class JOJWorker(): jojFailHomework = int( sum([item[0] for item in scores]) < 0.5 * sum([item[1] for item in scores])) + jojFailCompile = int(True in [item[0] == -1 for item in scores]) for _, stuName in value: res[stuName] = { "jojFailHomework": jojFailHomework, - "jojFailExercise": jojFailExercise + "jojFailExercise": jojFailExercise, + "jojFailCompile": jojFailCompile, } return res -- cgit v1.2.3