1616from kili .core .constants import MUTATION_BATCH_SIZE
1717from kili .core .utils .pagination import batcher
1818from kili .domain .issue import IssueFilters , IssueId , IssueStatus , IssueType
19+ from kili .domain .project import ProjectId
1920from kili .domain .types import ListOrTuple
2021from kili .utils import tqdm
2122
@@ -27,13 +28,16 @@ class IssueOperationMixin(BaseOperationMixin):
2728 """GraphQL Mixin extending GraphQL Gateway class with Issue related operations."""
2829
2930 def create_issues (
30- self , type_ : IssueType , issues : List [IssueToCreateKiliAPIGatewayInput ], description : str
31+ self ,
32+ project_id : ProjectId ,
33+ type_ : IssueType ,
34+ issues : List [IssueToCreateKiliAPIGatewayInput ],
35+ description : str ,
3136 ) -> List [IssueId ]:
3237 """Send a GraphQL request calling createIssues resolver."""
3338 created_issue_entities : List [IssueId ] = []
3439 with tqdm .tqdm (total = len (issues ), desc = description ) as pbar :
3540 for issues_batch in batcher (issues , batch_size = MUTATION_BATCH_SIZE ):
36- batch_targeted_asset_ids = [issue .asset_id for issue in issues_batch ]
3741 payload = {
3842 "issues" : [
3943 {
@@ -46,7 +50,7 @@ def create_issues(
4650 }
4751 for issue in issues_batch
4852 ],
49- "where" : {"idIn " : batch_targeted_asset_ids },
53+ "where" : {"project " : { "id" : project_id } },
5054 }
5155 result = self .graphql_client .execute (GQL_CREATE_ISSUES , payload )
5256 batch_created_issues = result ["data" ]
0 commit comments