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

6598 - Add training cards #7628

Merged
merged 26 commits into from
Jul 1, 2022

Conversation

latin-panda
Copy link
Contributor

@latin-panda latin-panda commented May 23, 2022

Description

This PR:

  • Extends Enketo service to work with modals and save completed trainings.
  • Adds a new modal component, "training cards", to load Enketo training forms.
  • Extends XML Forms service to subscribe to training forms and react when new trainings are added.
  • Adds test coverage for all new code.

Ticket: #6598

Code review checklist

  • Readable: Concise, well named, follows the style guide, documented if necessary.
  • Documented: Configuration and user documentation on cht-docs
  • Tested: Unit and/or e2e where appropriate
  • Internationalised: All user facing text
  • Backwards compatible: Works with existing data and configuration or includes a migration. Any breaking changes documented in the release notes.

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

@latin-panda
Copy link
Contributor Author

latin-panda commented May 24, 2022

Hi @garethbowen, I think it'd be good to have feedback at this point.
The only thing pending is telemetry (next thing I'll be working) and any feedback the team gives today's night.
Thanks before hand
Edit: We're still trying to get a partner to implement this FR, so we still don't know if it's going to be 3.15.x. For now I've set master as base, once we know then I'll update the PR.

@garethbowen
Copy link
Member

Sorry I'm not available to review this this week. I'll have a look next week if you haven't found another volunteer by then!

@latin-panda
Copy link
Contributor Author

Hi @dianabarsan, do you have time to provide feedback? :)

Copy link
Member

@garethbowen garethbowen left a comment

Choose a reason for hiding this comment

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

Sorry for the delay here. I've given it a quick once over, but certainly not a full review. Happy to talk more about some of these concepts, particularly modal vs page, and db performance issues.

ddocs/medic/views/docs_by_replication_key/map.js Outdated Show resolved Hide resolved
webapp/src/ts/services/training-cards.service.ts Outdated Show resolved Hide resolved
webapp/src/ts/services/training-cards.service.ts Outdated Show resolved Hide resolved
…display_forms_in_modal

� Conflicts:
�	webapp/src/ts/services/enketo.service.ts
�	webapp/tests/karma/ts/selectors/index.spec.ts
�	webapp/tests/karma/ts/services/enketo.service.spec.ts
@latin-panda latin-panda changed the base branch from master to 3.15.x June 6, 2022 15:23
@latin-panda latin-panda changed the base branch from 3.15.x to 3.15.0-FR-training-cards June 6, 2022 15:31
Copy link
Member

@garethbowen garethbowen left a comment

Choose a reason for hiding this comment

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

Awesome!

I've put a few mostly minor suggestions inline.

This will also need a happy day end-to-end test in webdriverio so we have automatic regression testing.

webapp/src/ts/services/enketo.service.ts Outdated Show resolved Hide resolved
webapp/src/ts/services/training-cards.service.ts Outdated Show resolved Hide resolved
webapp/src/ts/services/training-cards.service.ts Outdated Show resolved Hide resolved
webapp/src/ts/services/training-cards.service.ts Outdated Show resolved Hide resolved
webapp/src/ts/services/training-cards.service.ts Outdated Show resolved Hide resolved
@garethbowen
Copy link
Member

I've come up with a couple of other questions overnight while thinking about this...

  1. Have you tested what happens if the training form has a long page? Does the modal get a scrollbar, or does the modal overflow and the window gets a scrollbar?
  2. Have you thought about purging at all? Will existing purging rules eventually purge the successful completion reports and prompt the user to train again?
  3. If the user cancels the training will they be prompted to do it again next time the app loads?
  4. If there are multiple trainings for the user to go through, will the next one show up when they finish the first one? Do they have to reload to get the next one?

@latin-panda
Copy link
Contributor Author

Have you tested what happens if the training form has a long page? Does the modal get a scrollbar, or does the modal overflow and the window gets a scrollbar?

Yes, the modal has scroll, but the team will advice to keep pages short as part of the best practices when designing trainings.

Have you thought about purging at all? Will existing purging rules eventually purge the successful completion reports and prompt the user to train again?

Yes, because we're letting training to behave as reports then the docs can be purged, the purge function will need to exclude trainings to prevent that. Also trainings can have a duration in days, so even if the completed training is deleted, it won't display to the user if the training has expired.

If the user cancels the training will they be prompted to do it again next time the app loads?

Yes, trainings will display when the app re/loads or if a new training is downloaded and it's set to display immediately. I haven't implemented an interval to show trainings again after X minutes, thinking to not disturb the user during other tasks, but this idea isn't completely discarded in the MVP yet, we'll observe user behaviours.

If there are multiple trainings for the user to go through, will the next one show up when they finish the first one? Do they have to reload to get the next one?

Trainings are display one at the time on re/load

Thanks for the questions, I'm going to link the team here in case there's a reconsideration or new ideas :)

@latin-panda
Copy link
Contributor Author

I took the topic to the team (care team channel) and these are the take aways for each topic:

Have you tested what happens if the training form has a long page? Does the modal get a scrollbar, or does the modal overflow and the window gets a scrollbar?

A/ Long content: We should always aim for concise content and for now we can control this. We are willing to iterate more to improve experience after the test proves this solution is effective.

Have you thought about purging at all? Will existing purging rules eventually purge the successful completion reports and prompt the user to train again?

A/ Purging: Good one to consider later, but it shouldn’t block this test.

If the user cancels the training will they be prompted to do it again next time the app loads?

A/ Canceling: If a user cancels the training it makes sense to show it to them again on reload (instead of after x minutes), we want to observe the user behaviour.

If there are multiple trainings for the user to go through, will the next one show up when they finish the first one? Do they have to reload to get the next one?

A/ Multiple trainings: We control this for the test.

Linking here the other topic about when to display trainings for traceability with team discussion.

@latin-panda latin-panda marked this pull request as ready for review June 14, 2022 11:00
Copy link
Member

@garethbowen garethbowen left a comment

Choose a reason for hiding this comment

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

Awesome work! This is a really exciting feature.

Two suggestions inline, but approved pending those fixes.

webapp/src/ts/services/training-cards.service.ts Outdated Show resolved Hide resolved
webapp/src/ts/services/training-cards.service.ts Outdated Show resolved Hide resolved
@latin-panda latin-panda merged commit be01ceb into 3.15.0-FR-training-cards Jul 1, 2022
@latin-panda latin-panda deleted the 6598_display_forms_in_modal branch July 1, 2022 02:48
@latin-panda latin-panda mentioned this pull request Jan 16, 2023
5 tasks
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