Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor validation IF119 #4277

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Conversation

MosheEichler
Copy link
Contributor

@MosheEichler MosheEichler commented May 15, 2024

Related Issues

fixes:

Description

Refactored validation IF119, Check whether a selectValue key in an incidentField of type singleSelect do not contain multiple or only empty options.

Copy link

Changelog(s) in markdown:

  • Refactored validation IF119, Check whether a selectValue key in an incidentField of type singleSelect do not contain multiple or only empty options. #4277

Copy link
Contributor

@DeanArbel DeanArbel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a body to the PR

Copy link
Contributor

@YuvHayun YuvHayun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
See my comments.

@@ -0,0 +1,4 @@
changes:
- description: Refactored validation IF119, Check whether a selectValue key in an incidentField of type singleSelect do not contain multiple or only empty options.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- description: Refactored validation IF119, Check whether a selectValue key in an incidentField of type singleSelect do not contain multiple or only empty options.
- description: Added support for validation IF119 - "check whether a selectValue key in an incidentField of type singleSelect do not contain multiple or only empty options." for new validate flow.

def select_values_do_not_contain_multiple_or_only_empty_values_in_single_select_types(
content_item: ContentTypes,
) -> bool:
if content_item.data.get("type") == IncidentFieldType.SINGLE_SELECT:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add type as an attr of the IncidentField class.

content_item: ContentTypes,
) -> bool:
if content_item.data.get("type") == IncidentFieldType.SINGLE_SELECT:
select_values = content_item.data.get("selectValues") or []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for selectValues.

error_code = "IF119"
description = "We do not allow for incidentFields with singleSelect types to have in the selectValues more than one or only emtpy option"
rationale = "Due to UI issues, we cannot allow more than one or only empty values for selectValues field"
error_message = "singleSelect types cannot contain more than one or only empty values in the selectValues field."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make sure only the relevant issue appears, maybe consider returning the relevant error msg rather than True/False from select_values_do_not_contain_multiple_or_only_empty_values_in_single_select_types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants