Skip to content

Commit 301a76d

Browse files
[Feature:Plagiarism] Use active or all versions (#39)
* Initial rewrite of process_all.sh * Update process_all.sh * Make modifications to file paths and add timers * Overhaul concatenate_all.py * Implement all versions/active version feature * Fix python errors * Progress: everything through tokenization finished * Everything works * Add timers * remove unnecessary code * little python changes * William made an oopsie (forgot to deal with provided code) * Fix minor bugs Fix process_all.sh script plus fix spelling issue and prevent hash_all.py from breaking when empty tokenized files are written * Fix permissions issue with provided code editing * Remove typo * Remove unnecessary print statement Co-authored-by: williamjallen <[email protected]>
1 parent 3074497 commit 301a76d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

bin/concatenate_all.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ def main():
6666
semester = config["semester"]
6767
course = config["course"]
6868
gradeable = config["gradeable"]
69+
version_mode = config["version"]
6970
users_to_ignore = config["ignore_submissions"]
7071
regex_patterns = config["regex"].split(',')
7172
regex_dirs = config["regex_dirs"]
@@ -97,11 +98,20 @@ def main():
9798
elif user in users_to_ignore:
9899
continue
99100

101+
if version_mode == "active_version":
102+
# get the user's active version from their settings file
103+
submissions_details_path = os.path.join(user_path, 'user_assignment_settings.json')
104+
with open(submissions_details_path) as details_file:
105+
details_json = json.load(details_file)
106+
my_active_version = int(details_json["active_version"])
107+
100108
# loop over each version
101109
for version in sorted(os.listdir(user_path)):
102110
version_path = os.path.join(user_path, version)
103111
if not os.path.isdir(version_path):
104112
continue
113+
if version_mode == "active_version" and int(version) != my_active_version:
114+
continue
105115

106116
output_file_path = os.path.join(args.basepath, "users", user,
107117
version, "submission.concatenated")

0 commit comments

Comments
 (0)