Server backup 2026-11-07 of uncommitted work in projects/pharma-web-celtic
Snapshot of the working tree on srv1071960 (branch main), taken during server cleanup. .env files, node_modules, builds, logs and media were excluded.
This commit is contained in:
@@ -175,14 +175,14 @@ class UserService:
|
||||
return user
|
||||
|
||||
async def _end_role_assignments(self, user_id: uuid.UUID, old_role: Role) -> dict[str, int]:
|
||||
"""Close what the old role held: an MR's doctors and chemists, an AM's headquarters."""
|
||||
"""Close what the old role held: an MR's doctors and chemists, an ABM's headquarters."""
|
||||
today = date.today()
|
||||
if old_role in FIELD_ROLES:
|
||||
targets = [
|
||||
("doctors", DoctorAssignment, DoctorAssignment.mr_user_id),
|
||||
("chemists", ChemistAssignment, ChemistAssignment.mr_user_id),
|
||||
]
|
||||
elif old_role == Role.AM:
|
||||
elif old_role == Role.ABM:
|
||||
targets = [("headquarters", AMHeadquarters, AMHeadquarters.area_manager_user_id)]
|
||||
else:
|
||||
return {}
|
||||
@@ -204,7 +204,7 @@ class UserService:
|
||||
return list((await self.db.execute(stmt)).scalars().all())
|
||||
|
||||
async def my_profile(self, user: User) -> MyProfile:
|
||||
"""S4 — includes the reporting Area Manager DERIVED through the headquarters."""
|
||||
"""S4 — includes the reporting Area Business Manager DERIVED through the headquarters."""
|
||||
hq_code = hq_name = None
|
||||
manager_id = manager_name = None
|
||||
|
||||
@@ -221,7 +221,7 @@ class UserService:
|
||||
AMHeadquarters.effective_to.is_(None),
|
||||
)
|
||||
)
|
||||
# A headquarters may have several Area Managers: name every one.
|
||||
# A headquarters may have several Area Business Managers: name every one.
|
||||
managers = list((await self.db.execute(stmt.order_by(User.full_name))).scalars())
|
||||
if managers:
|
||||
manager_id = managers[0].id
|
||||
|
||||
Reference in New Issue
Block a user