Skip to content

Commit c578666

Browse files
Merge pull request #2006 from kili-technology/lab-3967
fix(LAB-3967): fix project_users queries criteria
2 parents da43b98 + 41a03e1 commit c578666

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/kili/core/graphql/operations/project_user/queries.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ def __init__(
1717
organization_id: Optional[str] = None,
1818
status: Optional[Literal["ACTIVATED", "ORG_ADMIN", "ORG_SUSPENDED"]] = None,
1919
active_in_project: Optional[bool] = None,
20+
deleted: Optional[bool] = None,
2021
) -> None:
2122
self.project_id = project_id
2223
self.email = email
2324
self._id = _id
2425
self.organization_id = organization_id
2526
self.status = status
2627
self.active_in_project = active_in_project # user not deleted and nbr of labeled assets > 0
28+
self.deleted = deleted
2729
super().__init__()
2830

2931
def graphql_where_builder(self):
@@ -32,6 +34,7 @@ def graphql_where_builder(self):
3234
"id": self._id,
3335
"status": self.status,
3436
"activeInProject": self.active_in_project,
37+
"deleted": self.deleted,
3538
"project": {
3639
"id": self.project_id,
3740
},

src/kili/entrypoints/queries/project_user/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def project_users(
9494
status_in: Optional[Sequence[Literal["ACTIVATED", "ORG_ADMIN", "ORG_SUSPENDED"]]] = (
9595
"ACTIVATED",
9696
"ORG_ADMIN",
97+
"ORG_SUSPENDED",
9798
),
9899
fields: ListOrTuple[str] = (
99100
"activated",
@@ -143,6 +144,7 @@ def project_users(
143144
fields = [*fields, "status"]
144145

145146
where = ProjectUserWhere(
147+
deleted=False,
146148
project_id=project_id,
147149
email=email,
148150
_id=id,
@@ -176,6 +178,7 @@ def count_project_users(
176178
status_in: Optional[Sequence[Literal["ACTIVATED", "ORG_ADMIN", "ORG_SUSPENDED"]]] = (
177179
"ACTIVATED",
178180
"ORG_ADMIN",
181+
"ORG_SUSPENDED",
179182
),
180183
) -> int:
181184
"""Count the number of projects and their users that match a set of criteria.
@@ -196,6 +199,7 @@ def count_project_users(
196199
"""
197200
if status_in is None:
198201
where = ProjectUserWhere(
202+
deleted=False,
199203
project_id=project_id,
200204
email=email,
201205
_id=id,
@@ -206,6 +210,7 @@ def count_project_users(
206210
count = 0
207211
for status in set(status_in):
208212
where = ProjectUserWhere(
213+
deleted=False,
209214
project_id=project_id,
210215
email=email,
211216
_id=id,

tests/integration/entrypoints/client/queries/test_project_users_queries.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def test_project_users_query(mocker: pytest_mock.MockFixture):
1515
assert "query projectUsers" in query
1616
assert variables == {
1717
"where": {
18+
"deleted": False,
1819
"id": None,
1920
"status": None,
2021
"activeInProject": None,

0 commit comments

Comments
 (0)