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

fix(inheritance-report): Fixes for go live #17295

Merged
merged 2 commits into from
Dec 20, 2024
Merged

fix(inheritance-report): Fixes for go live #17295

merged 2 commits into from
Dec 20, 2024

Conversation

albinagu
Copy link
Member

@albinagu albinagu commented Dec 19, 2024

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
    • Added an enabled property for asset types (guns, real estate, vehicles) and heirs in the inheritance report, defaulting to true.
    • Introduced a new debt type option labeled DebtTypes.InsuranceInstitute.
  • UI Changes
    • Updated field names and titles for clarity in the assets section of the inheritance report.
    • Removed titles for certain fields in the prepaid inheritance section, affecting their display.
  • Enhancements
    • Expanded messaging framework for stock-related messages, improving localization.
    • Updated validation logic for assets and heirs to incorporate the new enabled property.

@albinagu albinagu requested a review from a team as a code owner December 19, 2024 12:39
Copy link
Contributor

coderabbitai bot commented Dec 19, 2024

Walkthrough

This pull request introduces several modifications across multiple files in the inheritance report template. The changes primarily focus on enhancing the data structure and form handling for inheritance-related applications. Key modifications include adding an enabled property to asset and heir schemas, updating field names and titles in various form sections, introducing new debt types and relationship enumerations, and expanding messaging capabilities for stock-related information.

Changes

File Path Change Summary
libs/application/template-api-modules/.../mappers.ts Added enabled property (defaulting to true) for guns, real estate, vehicles, and heirs. Introduced caseNumber in return type.
libs/application/templates/.../prerequisites.ts Removed tooltip from buildRadioField for ESTATE_INHERITANCE
libs/application/templates/.../assets.ts Renamed fields like propertyValuation to amount in bank accounts and stocks sections. Updated field titles for conditional rendering.
libs/application/templates/.../debtsAndFuneralCost.ts Added new debt type DebtTypes.InsuranceInstitute
libs/application/templates/.../applicant.ts Removed title from national ID field in prepaid inheritance section
libs/application/templates/.../inheritanceExecutor.ts Removed titles from national ID and description fields
libs/application/templates/.../dataSchema.ts Added enabled: z.boolean() to asset and heirs schemas
libs/application/templates/.../messages.ts Added new messages for stocks, including face value and rate of change
libs/application/templates/.../types.ts Updated RelationEnum and added InsuranceInstitute to DebtTypes

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • kksteini

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 Dec 19, 2024

Codecov Report

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

Project coverage is 35.68%. Comparing base (b76b7dd) to head (fb37432).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ules/templates/inheritance-report/utils/mappers.ts 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17295      +/-   ##
==========================================
- Coverage   35.70%   35.68%   -0.02%     
==========================================
  Files        6924     6951      +27     
  Lines      148637   148660      +23     
  Branches    42471    42451      -20     
==========================================
- Hits        53065    53047      -18     
- Misses      95572    95613      +41     
Flag Coverage Δ
api 3.33% <ø> (ø)
application-system-api 38.75% <0.00%> (+<0.01%) ⬆️
application-template-api-modules 27.68% <0.00%> (-0.02%) ⬇️
application-templates-inheritance-report 6.59% <ø> (ø)
application-ui-shell 22.31% <ø> (ø)

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

Files with missing lines Coverage Δ
...ates/inheritance-report/src/forms/prerequisites.ts 0.00% <ø> (ø)
...es/inheritance-report/src/forms/sections/assets.ts 0.00% <ø> (ø)
...e-report/src/forms/sections/debtsAndFuneralCost.ts 0.00% <ø> (ø)
...src/forms/sections/prepaidInheritance/applicant.ts 0.00% <ø> (ø)
...sections/prepaidInheritance/inheritanceExecutor.ts 0.00% <ø> (ø)
...templates/inheritance-report/src/lib/dataSchema.ts 0.00% <ø> (ø)
...n/templates/inheritance-report/src/lib/messages.ts 100.00% <ø> (ø)
...ules/templates/inheritance-report/utils/mappers.ts 2.92% <0.00%> (-0.06%) ⬇️

... and 80 files with indirect coverage changes


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 b76b7dd...fb37432. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

All test runs 841d00a 🔗

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 2.52s 1 no change Link
application-system-api 0 0 0 46 0 2m 10.37s 1 no change Link
application-template-api-modules 0 0 0 118 0 2m 3.42s 1 no change Link
application-ui-shell 0 0 0 74 0 30.64s 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: 0

🧹 Nitpick comments (2)
libs/application/templates/inheritance-report/src/lib/dataSchema.ts (1)

58-58: LGTM: Schema updated for asset enablement

The addition of the enabled boolean field to the asset schema aligns with the mapper changes. Consider adding a JSDoc comment to document the purpose of this field.

+  /** Indicates whether the asset should be included in calculations */
   enabled: z.boolean(),
libs/application/templates/inheritance-report/src/lib/messages.ts (1)

711-725: Consider adding more descriptive message descriptions.

The message definitions are well-structured and maintain consistency with the file's pattern. However, the description field could be more informative to help other developers understand the context and usage of these messages.

Consider adding more descriptive message descriptions:

  stocksFaceValue: {
    id: 'ir.application:stocksFaceValue',
    defaultMessage: 'Nafnverð á dánardegi',
-    description: '',
+    description: 'Label for stock face value field at date of death',
  },
  stocksFaceValuePrePaid: {
    id: 'ir.application:stocksFaceValuePrePaid',
    defaultMessage: 'Nafnverð',
-    description: '',
+    description: 'Label for stock face value field in prepaid inheritance context',
  },
  stocksRateOfChange: {
    id: 'ir.application:stocksRateOfChange',
    defaultMessage: 'Gengi á dánardegi',
-    description: '',
+    description: 'Label for stock rate of change field at date of death',
  },
  stocksRateOfChangePrePaid: {
    id: 'ir.application:stocksRateOfChangePrePaid',
    defaultMessage: 'Gengi',
-    description: '',
+    description: 'Label for stock rate of change field in prepaid inheritance context',
  },
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1b5773d and 37613b8.

📒 Files selected for processing (9)
  • libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/utils/mappers.ts (3 hunks)
  • libs/application/templates/inheritance-report/src/forms/prerequisites.ts (0 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/assets.ts (3 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/debtsAndFuneralCost.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/applicant.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.ts (2 hunks)
  • libs/application/templates/inheritance-report/src/lib/dataSchema.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/lib/messages.ts (1 hunks)
  • libs/application/templates/inheritance-report/src/types.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • libs/application/templates/inheritance-report/src/forms/prerequisites.ts
🧰 Additional context used
📓 Path-based instructions (8)
libs/application/templates/inheritance-report/src/forms/sections/debtsAndFuneralCost.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/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.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/template-api-modules/src/lib/modules/templates/inheritance-report/utils/mappers.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/inheritance-report/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/inheritance-report/src/types.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/inheritance-report/src/forms/sections/prepaidInheritance/applicant.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/inheritance-report/src/forms/sections/assets.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/inheritance-report/src/lib/messages.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 (12)
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/applicant.ts (2)

Line range hint 1-57: Implementation looks good!

The code follows best practices:

  • Proper use of TypeScript for type safety
  • Reusable form building components
  • Clear structure and organization
  • Consistent use of message constants for internationalization

23-23: Verify accessibility impact of removing the field title

Removing the title from the national ID field might impact screen reader accessibility. Please ensure that:

  1. The field remains properly labeled for screen readers
  2. The design system accounts for this empty title
  3. The user can still understand the purpose of this field
libs/application/templates/inheritance-report/src/forms/sections/prepaidInheritance/inheritanceExecutor.ts (1)

29-29: Consider accessibility implications of empty titles

Removing titles from form fields might impact accessibility. Ensure that these fields have proper aria-labels or other accessibility features to maintain usability for screen readers.

Consider implementing a consistent pattern for field labeling across the application, possibly using:

  • Floating labels
  • Hidden labels with aria-label attributes
  • Label positioning through CSS

Also applies to: 76-76

libs/application/templates/inheritance-report/src/forms/sections/debtsAndFuneralCost.ts (1)

90-92: Verify handling of new debt type

The addition of InsuranceInstitute as a debt type looks good, but ensure that:

  1. All downstream processing handles this new debt type correctly
  2. Validation logic accommodates this new type
✅ Verification successful

Let me gather more information about the validation and processing of debt types.


Let me try a different search pattern to find any validation or processing logic.


Based on the search results, I can now provide a definitive response about the debt type validation and processing:

The addition of InsuranceInstitute debt type is properly handled

The codebase shows that:

  1. The new InsuranceInstitute debt type is properly defined in the local enum DebtTypes in types.ts
  2. The debt type is correctly added to the form selections alongside other existing debt types
  3. No special validation is required as it follows the same pattern as other debt types in the form structure

The implementation is consistent with the existing debt types pattern and doesn't require additional validation logic since:

  • Debt types are handled through a simple enum selection in the form
  • The form component handles all debt types uniformly through the selections array
  • No special processing logic exists for individual debt types
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any validation logic related to debt types
rg -A 5 "DebtTypes\." $(fd -e ts -e tsx)

# Check for any processing of debt types
ast-grep --pattern 'function $_($$_) {
  $$$
  DebtTypes.$_
  $$$
}'

Length of output: 91002


Script:

#!/bin/bash
# Check for validation logic specifically around debt types
ast-grep --pattern 'function $_($$_) {
  $$$
  DebtTypes.$_
  $$$
  validate
  $$$
}'

# Check for any transformations or processing of debt types
ast-grep --pattern 'function $_($$_) {
  $$$
  DebtTypes.$_
  $$$
  transform
  $$$
}'

# Look for any mappers or converters that handle debt types
ast-grep --pattern 'const $_ = {
  $$$
  DebtTypes.$_
  $$$
}'

Length of output: 241


Script:

#!/bin/bash
# Search for files that import and use DebtTypes
rg -l "import.*DebtTypes" $(fd -e ts -e tsx)

# Look for any validation or processing code in those files
rg "DebtTypes" -A 10 -B 10 $(fd -e ts -e tsx)

Length of output: 110402

libs/application/templates/inheritance-report/src/types.ts (2)

308-308: LGTM: New debt type addition

The addition of InsuranceInstitute to DebtTypes is properly implemented.


Line range hint 266-271: Address TODO comment and verify RelationEnum changes

The RelationEnum has been significantly modified, changing from relationship types (PARENT, CHILD, etc.) to role types (REPRESENTATIVE, HEIR, etc.). This is a breaking change that requires careful verification.

The TODO comment "do these value labels make sense?" should be addressed before going live.

libs/application/template-api-modules/src/lib/modules/templates/inheritance-report/utils/mappers.ts (4)

160-160: LGTM: Consistent implementation of the enabled property

The addition of the enabled property with a default value of true is implemented consistently across guns, realEstate, and vehicles assets. This maintains backward compatibility while supporting the new feature.

Also applies to: 203-203, 232-232


Line range hint 497-500: LGTM: Improved context-specific labeling

The conditional title implementation for stocks amount field appropriately handles different inheritance contexts, enhancing user experience with context-specific labels.


Line range hint 506-509: LGTM: Consistent conditional labeling pattern

The exchange rate field follows the same conditional title pattern as the amount field, maintaining consistency in the UI.


Line range hint 348-348: Verify data migration for bank account field renaming

The field renaming from 'propertyValuation' to 'amount' is semantically better, but requires verification of existing data migration.

Also applies to: 379-379

libs/application/templates/inheritance-report/src/forms/sections/assets.ts (2)

Line range hint 348-379: LGTM: Consistent field renaming in form definition

The bank account field renaming is consistently applied in the form definition, including the sumField reference.


497-509: LGTM: Well-structured conditional field labels

The conditional titles for stocks fields are well-implemented, providing appropriate context-specific labels while maintaining consistency with the codebase patterns.

@albinagu albinagu added automerge Merge this PR as soon as all checks pass and removed automerge Merge this PR as soon as all checks pass labels Dec 19, 2024
@kodiakhq kodiakhq bot merged commit e146770 into main Dec 20, 2024
40 checks passed
@kodiakhq kodiakhq bot deleted the efs_fixes_19.12 branch December 20, 2024 09:08
albinagu added a commit that referenced this pull request Dec 20, 2024
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
kodiakhq bot added a commit that referenced this pull request Dec 20, 2024
* fix(inheritance-report): Fixes for go live (#17295)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(inheritance-report): bugfixing 20.12 (#17322)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
kodiakhq bot added a commit that referenced this pull request Dec 20, 2024
…#17342)

* fix(inheritance-report): Fixes for go live (#17295)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(inheritance-report): bugfixing 20.12 (#17322)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* fix(inheritance-report): Send uploaded files data to syslumenn (#17325)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

---------

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

Successfully merging this pull request may close these issues.

2 participants