@@ -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