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

M2-7011: feat conditional logic extend item type #883

Merged

Conversation

felipeMetaLab
Copy link
Contributor

@felipeMetaLab felipeMetaLab commented Oct 29, 2024

📝 Description

🔗 Jira Ticket M2-7011
This PR is focused to extend and create item types and conditional logic.
here is described the rules it must to follow:
https://mindlogger.atlassian.net/wiki/spaces/MINDLOGGER1/pages/596410369/Item+Flow+-+Extend+the+list+of+supported+Item+Types

📸 Screenshots

Screenshot 2024-10-27 at 9 28 09 PM

Screen.Recording.2024-10-28.at.2.02.27.PM.mov
Screen.Recording.2024-10-27.at.9.29.36.PM.mov

🪤 Peer Testing

1 - Launch admin app, and create a new applet or open an existed one.
2 - go to the items and create the items you would like to test, example, Date, Message, Text ...
3 - click on "item flow" tab and create your conditional logic, example:
Screenshot 2024-10-27 at 9 28 09 PM
4 - launch the app and choose the applet you created.
5 - check if the logic is working, I left a video sample to demonstrate one of the logics.

✏️ Notes

For it works on development it depends of the backend, the backend branch I am testing is: ffeature/M2-8209_adding_FieldName_to_time_payload

Somehow when you create a condition on admin side, the date looks little different, so its super important makes a validation based on what was inserted on API
Screenshot 2024-11-11 at 12 09 17 AM

@felipeMetaLab felipeMetaLab changed the title feature / conditional logic extend item teype M2-7011: feat conditional logic extend item type Oct 30, 2024
Copy link
Member

@andrevitalb andrevitalb left a comment

Choose a reason for hiding this comment

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

Some minor nit changes, but good overall 🤓. Will do a local test run of all logical conditions. Ok to pre-approve

src/entities/activity/model/mappers.ts Outdated Show resolved Hide resolved
// @ts-expect-error
delete updatedCondition.itemName;
switch (condition.type) {
Copy link
Member

Choose a reason for hiding this comment

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

Some cases are missing from this one, that aren't straightforward

payload: {
  value: number;
};

General conditions
case 'BETWEEN':
case 'OUTSIDE_OF':

Row option conditions
case 'EQUAL_TO_ROW_OPTION':
case 'NOT_EQUAL_TO_ROW_OPTION':

Slider row conditions
case 'GREATER_THAN_SLIDER_ROWS':
case 'LESS_THAN_SLIDER_ROWS':
case 'EQUAL_TO_SLIDER_ROWS':
case 'NOT_EQUAL_TO_SLIDER_ROWS':
case 'BETWEEN_SLIDER_ROWS':
case 'OUTSIDE_OF_SLIDER_ROWS':

Should those be added?

Copy link
Contributor Author

@felipeMetaLab felipeMetaLab Nov 18, 2024

Choose a reason for hiding this comment

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

not really, thats not necessary, but it would be good, actually no one of the items added are necessary as long as I have "updatedCondition.payload = condition.payload;", but I really think this mapper that I created helps to understand how the payload is working, and being applied, so I will add a "case" for those that is missing.

Copy link
Contributor Author

@felipeMetaLab felipeMetaLab Nov 18, 2024

Choose a reason for hiding this comment

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

the only ones I dont recommend to be mapped, right now is BETWEEN, OUSIDE_OF, GREATER_THAN ..., because its being used for multiples parts and it must to be generic (due a lot of payload), or we could map but keep it generic with same payload of "default"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done I added a case for those ones that are specific, like GREATER_THAN_SLIDER_ROWS ...

src/entities/activity/model/mappers.ts Show resolved Hide resolved
src/entities/conditional-logic/model/conditions.ts Outdated Show resolved Hide resolved
src/features/pass-survey/model/AnswerValidator.ts Outdated Show resolved Hide resolved
src/features/pass-survey/model/AnswerValidator.ts Outdated Show resolved Hide resolved
src/shared/api/services/ActivityItemDto.ts Show resolved Hide resolved
felipeMetaLab and others added 4 commits November 18, 2024 04:36
Copy link
Member

@andrevitalb andrevitalb 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!

Note: Would seriously prefer if the === changes are added 🤓

src/entities/conditional-logic/model/conditions.ts Outdated Show resolved Hide resolved
const inputMinutes = timeToMinutes(input);
const conditionMinutes = timeToMinutes(time);

const result = inputMinutes == conditionMinutes;
Copy link
Member

Choose a reason for hiding this comment

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

👀

Copy link
Member

@andrevitalb andrevitalb 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!

@felipeMetaLab felipeMetaLab merged commit b083b94 into dev Nov 19, 2024
5 checks passed
ChaconC added a commit that referenced this pull request Dec 6, 2024
ChaconC added a commit that referenced this pull request Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants