Multiple admins and unnamed team
* fixes bug where an unnamed team would have been created * adds every migrated team user as admin as well
This commit is contained in:
parent
dd5cbbef10
commit
5d1815b31c
@ -186,8 +186,10 @@ class BaseMigrater:
|
|||||||
""" Returns a team from given name
|
""" Returns a team from given name
|
||||||
|
|
||||||
"""
|
"""
|
||||||
name = f"Team {team_name}"
|
if len(team_name) == 0:
|
||||||
|
return None
|
||||||
|
|
||||||
|
name = f"Team {team_name}"
|
||||||
description = f"Automatisch erzeugtes Team für {team_name}"
|
description = f"Automatisch erzeugtes Team für {team_name}"
|
||||||
team = Team.objects.get_or_create(
|
team = Team.objects.get_or_create(
|
||||||
name=name,
|
name=name,
|
||||||
|
@ -87,11 +87,13 @@ class UserMigrater(BaseMigrater):
|
|||||||
if company_team is not None and len(user_teams) == 0:
|
if company_team is not None and len(user_teams) == 0:
|
||||||
# Only team is the company team
|
# Only team is the company team
|
||||||
company_team.users.add(user)
|
company_team.users.add(user)
|
||||||
|
company_team.admins.add(user)
|
||||||
else:
|
else:
|
||||||
if company_team is not None:
|
if company_team is not None:
|
||||||
company_team.delete()
|
company_team.delete()
|
||||||
for team in user_teams:
|
for team in user_teams:
|
||||||
team.users.add(user)
|
team.users.add(user)
|
||||||
|
team.admins.add(user)
|
||||||
num_processed += 1
|
num_processed += 1
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user