Skip to content

Commit 9ccf8c8

Browse files
committed
Exclude deleted accounts from roles
1 parent 066d291 commit 9ccf8c8

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "recnetpy"
7-
version = "0.1.46"
7+
version = "0.1.47"
88
authors = [
99
{ name="RecNetBot Development"}
1010
]

src/recnetpy/dataclasses/room.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,5 +230,16 @@ async def resolve_role_owners(self) -> Optional[List['Role']]:
230230
accounts[role.account_id] = account
231231
data: 'Response[List[AccountResponse]]' = await self.rec_net.accounts.account.bulk.make_request('post', body = {"id": accounts.keys()})
232232
for data_response in data.data: accounts.get(data_response['accountId']).patch_data(data_response)
233+
234+
# Search for deleted accounts
235+
deleted = []
236+
for i in self.roles:
237+
if not hasattr(i.account, "username"):
238+
deleted.append(i)
239+
240+
# Eradicate them
241+
for i in deleted:
242+
self.roles.remove(i)
243+
233244
return self.roles
234245

0 commit comments

Comments
 (0)