Merge pull request #943 from MITx/feature/rocha/dashboard-software-licenses
Add fix for users with multiple licenses
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user