Skip to content

Commit 530bd62

Browse files
authored
Merge pull request #2043 from kili-technology/feature/lab-4295-aau-i-add-update-and-delete-steps-with-the-sdk-3
fix(LAB-4295): use the name of the step instead of id in add_review_s…
2 parents 70fbb4b + 324e3e1 commit 530bd62

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/kili/adapters/kili_api_gateway/project_workflow/operations_mixin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,13 @@ def add_review_step(self, data: AddReviewStepInput) -> dict:
203203
existing_members = self.list_activated_project_users(data.project_id)
204204
assignees_to_add = get_assignees_to_add_ids(existing_members, data.assignees)
205205
data.assignees = assignees_to_add
206+
steps = self.get_steps(data.project_id, fields=["steps.id", "steps.name"])
207+
send_back_to_step = next(
208+
(step.get("id") for step in steps if step.get("name") == data.send_back_to_step), None
209+
)
210+
if not send_back_to_step:
211+
raise ValueError("The sendBackToStep name given does not exist")
212+
data.send_back_to_step = send_back_to_step
206213
variables = {"input": add_review_step_input_mapper(data)}
207214
mutation = get_add_review_step_mutation()
208215
result = self.graphql_client.execute(mutation, variables)

src/kili/presentation/client/project_workflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def add_review_step(
163163
assignees: List of user emails to assign as reviewers.
164164
step_coverage: Percentage of assets to be reviewed in this step (0-100).
165165
use_honeypot: Whether to use honeypot on this step.
166-
send_back_to_step: Id of the step to send assets back to.
166+
send_back_to_step: Name of the step to send assets back to.
167167
168168
Returns:
169169
A dict with the created step data (id, name).

0 commit comments

Comments
 (0)