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

feat(health-insurance-declaration): Make it possible to select only child for health insurance declaration #15818

Merged
merged 11 commits into from
Sep 4, 2024

Conversation

norda-gunni
Copy link
Member

@norda-gunni norda-gunni commented Aug 29, 2024

and fix a bug that stopped the list of applicants from including children

...

Attach a link to issue if relevant

What

Specify what you're trying to achieve

Why

Specify why you need to achieve this

Screenshots / Gifs

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Introduced a new checkbox for selecting individual applicants in the health insurance declaration form.
    • Updated the table title from "Family table" to "Applicants table" to reflect the new focus on applicants.
    • Enhanced validation logic to require selection of at least one applicant.
  • Improvements

    • Improved clarity of localization strings for better user understanding in the application.
    • Added new utility functions to streamline applicant data handling.
  • Bug Fixes

    • Minor formatting adjustment to ensure compliance with coding conventions.

…ration and fix a bug that stopped the list of applicants from including children
@norda-gunni norda-gunni requested a review from a team as a code owner August 29, 2024 14:35
Copy link
Contributor

coderabbitai bot commented Aug 29, 2024

Walkthrough

The changes involve a transition from a family-centric model to an applicant-centric model in the health insurance declaration process. This includes updates to data handling, validation logic, user interface text, and utility functions, allowing users to select individual applicants instead of families.

Changes

File Path Change Summary
libs/application/templates/health-insurance-declaration/mockData/... Added a newline character before the closing brace in the JSON file.
libs/application/templates/health-insurance-declaration/src/forms/... Updated the HealthInsuranceDeclarationForm to handle individual applicants, including new checkbox fields and updated table titles.
libs/application/templates/health-insurance-declaration/src/lib/dataSchema.ts Modified HealthInsuranceDeclarationSchema to include a new optional field for applicant checkboxes and updated validation logic.
libs/application/templates/health-insurance-declaration/src/lib/messages/... Updated localization strings in application.ts for clarity, focusing on applicants instead of families.
libs/application/templates/health-insurance-declaration/src/utils/... Introduced new functions for handling applicant data and renamed existing functions to reflect the new applicant-centric approach.
libs/application/template-api-modules/src/lib/modules/templates/... Refactored getApplicants function to utilize external data for populating the applicants array based on selected applicants.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 0% with 17 lines in your changes missing coverage. Please review.

Project coverage is 36.93%. Comparing base (7fd1639) to head (b0febbf).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...-declaration/health-insurance-declaration.utils.ts 0.00% 15 Missing ⚠️
...health-insurance-declaration/src/lib/dataSchema.ts 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15818      +/-   ##
==========================================
- Coverage   36.93%   36.93%   -0.01%     
==========================================
  Files        6681     6681              
  Lines      136460   136464       +4     
  Branches    38749    38749              
==========================================
  Hits        50401    50401              
- Misses      86059    86063       +4     
Flag Coverage Δ
api 3.39% <ø> (ø)
application-system-api 41.74% <0.00%> (-0.01%) ⬇️
application-template-api-modules 23.67% <0.00%> (+0.01%) ⬆️
application-ui-shell 21.17% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...urance-declaration/src/lib/messages/application.ts 100.00% <ø> (ø)
...health-insurance-declaration/src/lib/dataSchema.ts 17.24% <0.00%> (-0.62%) ⬇️
...-declaration/health-insurance-declaration.utils.ts 20.31% <0.00%> (-1.00%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7fd1639...b0febbf. Read the comment docs.

@norda-gunni norda-gunni changed the title feat(health-insurance-declaration): Make it posible to select only child for health insurance declaration feat(health-insurance-declaration): Make it possible to select only child for health insurance declaration Aug 29, 2024
@datadog-island-is
Copy link

datadog-island-is bot commented Aug 29, 2024

Datadog Report

All test runs c765ee7 🔗

4 Total Test Services: 0 Failed, 4 Passed
➡️ Test Sessions change in coverage: 8 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
api 0 0 0 4 0 3.16s 1 no change Link
application-system-api 0 0 0 111 2 3m 8.72s 1 no change Link
application-template-api-modules 0 0 0 109 0 1m 53.8s 1 no change Link
application-ui-shell 0 0 0 74 0 37.07s 1 no change Link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between c4eba52 and d0ec816.

Files selected for processing (5)
  • libs/application/templates/health-insurance-declaration/mockData/health-insurance-declaration.json (1 hunks)
  • libs/application/templates/health-insurance-declaration/src/forms/HealthInsuranceDeclarationForm.ts (5 hunks)
  • libs/application/templates/health-insurance-declaration/src/lib/dataSchema.ts (1 hunks)
  • libs/application/templates/health-insurance-declaration/src/lib/messages/application.ts (4 hunks)
  • libs/application/templates/health-insurance-declaration/src/utils/data.ts (3 hunks)
Files skipped from review due to trivial changes (1)
  • libs/application/templates/health-insurance-declaration/mockData/health-insurance-declaration.json
Additional context used
Path-based instructions (4)
libs/application/templates/health-insurance-declaration/src/lib/dataSchema.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/health-insurance-declaration/src/utils/data.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/health-insurance-declaration/src/lib/messages/application.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/health-insurance-declaration/src/forms/HealthInsuranceDeclarationForm.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Additional comments not posted (14)
libs/application/templates/health-insurance-declaration/src/lib/dataSchema.ts (3)

26-28: LGTM!

The addition of new fields registerPersonsApplicantCheckboxField, registerPersonsSpouseCheckboxField, and registerPersonsChildrenCheckboxField aligns with the requirement to select applicants.


33-44: LGTM!

The validation logic is correctly implemented and enhances the robustness of the schema.


37-44: LGTM!

The custom issues are correctly added and provide clear feedback to the user.

libs/application/templates/health-insurance-declaration/src/utils/data.ts (3)

137-141: LGTM!

The getApplicantFromExternalData function is correctly implemented and retrieves the applicant's information from the externalData.


143-152: LGTM!

The getApplicantAsOption function is correctly implemented and provides the necessary formatting for the applicant's information.


Line range hint 170-227: LGTM!

The getSelectedApplicants function is correctly updated to handle the broader scope of functionality and the logic is correctly implemented.

libs/application/templates/health-insurance-declaration/src/lib/messages/application.ts (5)

46-48: LGTM!

The new section title "Nám/ferðir" is more concise and relevant.


51-53: LGTM!

The new section description "Er sótt um vegna ferða eða náms?" is clearer and better aligns with user intent.


85-89: LGTM!

The new entry applicantTitle enhances the structure of the application by providing clearer labels for user input sections.


124-126: LGTM!

The new placeholder text "Veldur land sem ferðast á til" is clearer and more accurate.


226-229: LGTM!

The new identifier applicantsTableTitle and default message "Sótt er um fyrir" are more relevant and align with the changes in the application.

libs/application/templates/health-insurance-declaration/src/forms/HealthInsuranceDeclarationForm.ts (3)

37-38: LGTM!

The import statements are correctly updated to include the new utility functions getSelectedApplicants and getApplicantAsOption.


273-280: LGTM!

The checkbox field for selecting applicants is correctly implemented, with the default value and options derived using the getApplicantAsOption function.


502-506: LGTM!

The static table field is correctly updated to display selected applicants, with the title changed to "Applicants table" and the logic for populating the rows modified to use getSelectedApplicants.

…ration and fix a bug that stopped the list of applicants from including children
Copy link
Member

@Toti91 Toti91 left a comment

Choose a reason for hiding this comment

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

LGTM, but do we want have to update the submit method in the template-api with this new data?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d0ec816 and cfd000b.

Files selected for processing (1)
  • libs/application/templates/health-insurance-declaration/src/lib/messages/application.ts (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • libs/application/templates/health-insurance-declaration/src/lib/messages/application.ts

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cfd000b and 93c919e.

Files selected for processing (3)
  • libs/application/template-api-modules/src/lib/modules/templates/health-insurance-declaration/health-insurance-declaration.utils.ts (1 hunks)
  • libs/application/templates/health-insurance-declaration/mockData/health-insurance-declaration.json (1 hunks)
  • libs/application/templates/health-insurance-declaration/src/lib/dataSchema.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • libs/application/templates/health-insurance-declaration/mockData/health-insurance-declaration.json
Files skipped from review as they are similar to previous changes (1)
  • libs/application/templates/health-insurance-declaration/src/lib/dataSchema.ts
Additional context used
Path-based instructions (1)
libs/application/template-api-modules/src/lib/modules/templates/health-insurance-declaration/health-insurance-declaration.utils.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
Additional comments not posted (1)
libs/application/template-api-modules/src/lib/modules/templates/health-insurance-declaration/health-insurance-declaration.utils.ts (1)

59-73: Ensure consistency in applicant data.

The current implementation uses answers.applicant.nationalId and answers.applicant.name for the applicant's data. Ensure that this data is consistent with the external data.

Run the following script to verify the consistency of applicant data:

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 93c919e and 8f875e2.

Files selected for processing (2)
  • libs/application/template-api-modules/src/lib/modules/templates/health-insurance-declaration/health-insurance-declaration.utils.ts (1 hunks)
  • libs/application/templates/health-insurance-declaration/src/forms/HealthInsuranceDeclarationForm.ts (4 hunks)
Files skipped from review as they are similar to previous changes (2)
  • libs/application/template-api-modules/src/lib/modules/templates/health-insurance-declaration/health-insurance-declaration.utils.ts
  • libs/application/templates/health-insurance-declaration/src/forms/HealthInsuranceDeclarationForm.ts

@norda-gunni norda-gunni marked this pull request as draft August 30, 2024 09:04
@norda-gunni norda-gunni marked this pull request as ready for review September 4, 2024 10:55
@norda-gunni norda-gunni requested a review from Toti91 September 4, 2024 10:55
@Toti91 Toti91 added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Sep 4, 2024
@kodiakhq kodiakhq bot merged commit e07e94d into main Sep 4, 2024
36 checks passed
@kodiakhq kodiakhq bot deleted the feat/insurance-declaration-child-only branch September 4, 2024 11:08
jonnigs pushed a commit that referenced this pull request Sep 12, 2024
…hild for health insurance declaration (#15818)

* feat: Make it posible to select only child for health insurance declaration and fix a bug that stopped the list of applicants from including children

* chore: nx format:write update dirty files

* feat: Make it posible to select only child for health insurance declaration and fix a bug that stopped the list of applicants from including children

* chore: nx format:write update dirty files

* Fix default message

* pr comment

* Update service

* chore: nx format:write update dirty files

* simplify applicant handling

---------

Co-authored-by: andes-it <builders@andes.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants