Skip to content

Commit 95b77ef

Browse files
[Bugfix:Plagiarism] Support incomplete gradeables (#66)
* Support gradeables without user_assignment_settings.json file * Remove debugging statements
1 parent 45060df commit 95b77ef

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ tools/assignments/*
33
__pycache__
44
tests/__pycache__
55
vendor/
6+
cmake-build-debug/*
7+
.idea
8+
.DS_Store

bin/concatenate_all.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,16 @@ def main():
159159
continue
160160

161161
if version_mode == "active_version":
162-
# get the user's active version from their settings file
162+
# get the user's active version from their settings file if it exists, else get
163+
# most recent version for compatibility with early versions of Submitty
163164
submissions_details_path = os.path.join(user_path, 'user_assignment_settings.json')
164-
with open(submissions_details_path) as details_file:
165-
details_json = json.load(details_file)
166-
my_active_version = int(details_json["active_version"])
165+
if os.path.exists(submissions_details_path):
166+
with open(submissions_details_path) as details_file:
167+
details_json = json.load(details_file)
168+
my_active_version = int(details_json["active_version"])
169+
else:
170+
# get the most recent version
171+
my_active_version = sorted(os.listdir(user_path))[-1]
167172

168173
# loop over each version
169174
for version in sorted(os.listdir(user_path)):
@@ -206,13 +211,17 @@ def main():
206211
continue
207212

208213
if version_mode == "active_version":
209-
# get the user's active version from their settings file
214+
# get the user's active version from their settings file if it exists, else get
215+
# most recent version for compatibility with early versions of Submitty
210216
other_submissions_details_path = os.path.join(other_user_path,
211217
'user_assignment_settings.json')
212-
213-
with open(other_submissions_details_path) as other_details_file:
214-
other_details_json = json.load(other_details_file)
215-
my_active_version = int(other_details_json["active_version"])
218+
if os.path.exists(other_submissions_details_path):
219+
with open(other_submissions_details_path) as other_details_file:
220+
other_details_json = json.load(other_details_file)
221+
my_active_version = int(other_details_json["active_version"])
222+
else:
223+
# get the most recent version
224+
my_active_version = sorted(os.listdir(other_user_path))[-1]
216225

217226
# loop over each version
218227
for other_version in sorted(os.listdir(other_user_path)):

0 commit comments

Comments
 (0)