Commit 3784c3ce by Carlos Andrés Rocha

Add fix for users with multiple licenses

parent 853051bc
......@@ -42,7 +42,10 @@ def get_courses_licenses(user, courses):
def get_license(user, software):
try:
license = UserLicense.objects.get(user=user, software=software)
# TODO: temporary fix for when somehow a user got more that one license.
# The proper fix should use Meta.unique_together in the UserLicense model.
licenses = UserLicense.objects.filter(user=user, software=software)
license = licenses[0] if licenses else None
except UserLicense.DoesNotExist:
license = None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment