Skip to content

Commit

Permalink
Merge pull request #1805 from gtech-mulearn:dev
Browse files Browse the repository at this point in the history
[PATCH] user muid edit bug
  • Loading branch information
MZaFaRM authored Dec 12, 2023
2 parents 416a7bd + 130f2bf commit 70b59a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ def profile_pic(self):
return f"{decouple_config('BE_DOMAIN_NAME')}{fs.url(path)}"

def save(self, *args, **kwargs):
if self.pk is None:
if self.muid is None:
full_name = f"{self.first_name}{self.last_name or ''}".replace(" ", "").lower()[:85]
self.muid = f"{full_name}@mulearn"

counter = 0
while User.objects.filter(muid=self.muid).exists():
counter += 1
self.muid = f"{full_name}-{counter}@mulearn"

return super().save(*args, **kwargs)


Expand Down

0 comments on commit 70b59a0

Please sign in to comment.