Skip to content

Commit

Permalink
Purge non-dict UserProfile.metadata when…
Browse files Browse the repository at this point in the history
calculating submission counters (instead of crashing)
  • Loading branch information
jnm committed Aug 30, 2023
1 parent ace93da commit f31b2a1
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def suspend_submissions_for_user(self, user: 'auth.User'):
) = UserProfile.objects.get_or_create(user_id=user.pk)

# Some old profiles don't have metadata
if user_profile.metadata is None:
if user_profile.metadata is None or not isinstance(user_profile.metadata, dict):
user_profile.metadata = {}

# Set the flag `submissions_suspended` to true if it is not already.
Expand Down

0 comments on commit f31b2a1

Please sign in to comment.