Skip to content

Commit

Permalink
fix(SUP-1982): add skip and auto-assign parameters on copy project
Browse files Browse the repository at this point in the history
  • Loading branch information
FannyGaudin committed Nov 15, 2024
1 parent 133f644 commit 1d195df
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/kili/adapters/kili_api_gateway/project/mappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def project_data_mapper(data: ProjectDataKiliAPIGatewayInput) -> Dict:
"numberOfRemainingAssets": data.number_of_remaining_assets,
"numberOfReviewedAssets": data.number_of_reviewed_assets,
"reviewCoverage": data.review_coverage,
"secondsToLabelBeforeAutoAssign": data.seconds_to_label_before_auto_assign,
"shouldRelaunchKpiComputation": data.should_relaunch_kpi_computation,
"title": data.title,
"useHoneyPot": data.use_honeypot,
Expand Down
1 change: 1 addition & 0 deletions src/kili/adapters/kili_api_gateway/project/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class ProjectDataKiliAPIGatewayInput:
number_of_remaining_assets: Optional[int]
number_of_reviewed_assets: Optional[int]
review_coverage: Optional[int]
seconds_to_label_before_auto_assign: Optional[int]
should_relaunch_kpi_computation: Optional[bool]
title: Optional[str]
use_honeypot: Optional[bool]
5 changes: 5 additions & 0 deletions src/kili/presentation/client/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ def update_properties_in_project(
title: Optional[str] = None,
use_honeypot: Optional[bool] = None,
metadata_types: Optional[dict] = None,
seconds_to_label_before_auto_assign: Optional[int] = None,
) -> Dict[str, Any]:
"""Update properties of a project.
Expand Down Expand Up @@ -340,6 +341,9 @@ def update_properties_in_project(
metadata_types: Types of the project metadata.
Should be a `dict` of metadata fields name as keys and metadata types as values.
Currently, possible types are: `string`, `number`
seconds_to_label_before_auto_assign: When a user begins to annotate an asset,
it automatically gets assigned to them.
This ensures the user retains the asset until it is submitted.
Returns:
A dict with the changed properties which indicates if the mutation was successful,
Expand Down Expand Up @@ -388,6 +392,7 @@ def update_properties_in_project(
use_honeypot=use_honeypot,
title=title,
metadata_types=metadata_types,
seconds_to_label_before_auto_assign=seconds_to_label_before_auto_assign,
)

@typechecked
Expand Down
6 changes: 5 additions & 1 deletion src/kili/services/copy_project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ class ProjectCopier: # pylint: disable=too-few-public-methods
)
FIELDS_JSON_INTERFACE = ("jsonInterface",)
FIELDS_QUALITY_SETTINGS = (
"canSkipAsset",
"consensusTotCoverage",
"minConsensusSize",
"useHoneyPot",
"reviewCoverage",
"secondsToLabelBeforeAutoAssign",
"useHoneyPot",
)

def __init__(self, kili: "Kili") -> None:
Expand Down Expand Up @@ -156,10 +158,12 @@ def _copy_members(self, from_project_id: str, new_project_id: str) -> None:
def _copy_quality_settings(self, new_project_id: str, src_project: Dict) -> None:
self.kili.update_properties_in_project(
project_id=new_project_id,
can_skip_asset=src_project["canSkipAsset"],
consensus_tot_coverage=src_project["consensusTotCoverage"],
min_consensus_size=src_project["minConsensusSize"],
use_honeypot=src_project["useHoneyPot"],
review_coverage=src_project["reviewCoverage"],
seconds_to_label_before_auto_assign=src_project["secondsToLabelBeforeAutoAssign"],
)

def _copy_assets(self, from_project_id: str, new_project_id: str) -> None:
Expand Down
2 changes: 2 additions & 0 deletions src/kili/use_cases/project/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def update_properties_in_project(
title: Optional[str] = None,
use_honeypot: Optional[bool] = None,
metadata_types: Optional[Dict] = None,
seconds_to_label_before_auto_assign: Optional[int] = None,
) -> Dict[str, object]:
"""Update properties in a project."""
if consensus_tot_coverage is not None and not 0 <= consensus_tot_coverage <= 100:
Expand Down Expand Up @@ -158,6 +159,7 @@ def update_properties_in_project(
number_of_remaining_assets=number_of_remaining_assets,
number_of_reviewed_assets=number_of_reviewed_assets,
review_coverage=review_coverage,
seconds_to_label_before_auto_assign=seconds_to_label_before_auto_assign,
should_relaunch_kpi_computation=should_relaunch_kpi_computation,
title=title,
use_honeypot=use_honeypot,
Expand Down

0 comments on commit 1d195df

Please sign in to comment.