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(web): Pension Calculator - Add pension type for "New System" #16450

Merged
merged 4 commits into from
Oct 17, 2024

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Oct 17, 2024

Pension Calculator - Add pension type for "New System"

What

  • We've been instructed by the social insurance administration to call the pension calculation endpoint with the number 6 to get calculations from the "new system"

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

    • Updated pension calculation results to support a new pension system for 2025.
    • Introduced a new classification for base pension types, including NewSystem.
  • Bug Fixes

    • Enhanced logic for fetching pension calculation data to ensure accurate results based on the new system.
  • Documentation

    • Updated method signatures and enumerations to reflect changes in pension calculation handling.

@RunarVestmann RunarVestmann added the automerge Merge this PR as soon as all checks pass label Oct 17, 2024
@RunarVestmann RunarVestmann requested review from a team as code owners October 17, 2024 13:38
Copy link
Contributor

coderabbitai bot commented Oct 17, 2024

Walkthrough

The pull request introduces updates to the pension calculation logic for the year 2025 within the application. Key modifications include the addition of a new property, typeOfBasePension, in the PensionCalculatorResults.tsx file, which is conditionally set based on the active preview for 2025. Additionally, a new enumeration value, NewSystem, has been added to the BasePensionType enum, and a corresponding mapping for this new type has been introduced in the basePensionTypeMapping object. These changes facilitate the handling and display of pension results according to the new system.

Changes

File Change Summary
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx Updated to enhance pension calculation logic for 2025, added typeOfBasePension query parameter.
libs/api/domains/social-insurance/src/lib/dtos/pensionCalculation.input.ts Added new enum value NewSystem to BasePensionType enum.
libs/api/domains/social-insurance/src/lib/utils.ts Introduced mapping for BasePensionType.NewSystem with value 6 in basePensionTypeMapping.

Possibly related PRs

Suggested reviewers

  • thorkellmani
  • mannipje

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d8f8e73 and 5304516.

📒 Files selected for processing (1)
  • apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx

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
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

🧹 Outside diff range and nitpick comments (1)
libs/api/domains/social-insurance/src/lib/utils.ts (1)

24-24: LGTM! Consider adding a TODO for future reference.

The addition of [BasePensionType.NewSystem]: 6 aligns with the PR objectives and correctly implements the new pension type. The comment provides useful context about the effective date.

Consider adding a TODO comment to remind developers to review this implementation closer to the effective date:

-  [BasePensionType.NewSystem]: 6, // Nýtt kerfi sem tekur gildi 1. september 2025
+  [BasePensionType.NewSystem]: 6, // Nýtt kerfi sem tekur gildi 1. september 2025
+  // TODO: Review and potentially update this implementation before September 1, 2025

This will help ensure the implementation is re-evaluated closer to the launch date of the new system.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 17e1369 and d8f8e73.

📒 Files selected for processing (3)
  • apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx (1 hunks)
  • libs/api/domains/social-insurance/src/lib/dtos/pensionCalculation.input.ts (1 hunks)
  • libs/api/domains/social-insurance/src/lib/utils.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
apps/web/screens/Organization/SocialInsuranceAdministration/PensionCalculatorResults.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/api/domains/social-insurance/src/lib/dtos/pensionCalculation.input.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/api/domains/social-insurance/src/lib/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 (2)
libs/api/domains/social-insurance/src/lib/dtos/pensionCalculation.input.ts (1)

9-9: LGTM! Verify usage and update documentation.

The addition of the NewSystem enum value to BasePensionType is consistent with the existing structure and aligns with the PR objectives. This change maintains good practices for reusability and TypeScript usage.

To ensure completeness:

  1. Verify that all relevant parts of the codebase using BasePensionType are updated to handle this new value.
  2. Update any associated documentation to reflect this new pension type.

To verify the usage of the new enum value, run the following script:

libs/api/domains/social-insurance/src/lib/utils.ts (1)

Line range hint 1-238: Code adheres to guidelines and change is well-integrated.

The addition of the new pension type is well-integrated into the existing code:

  1. The mapPensionCalculationInput function automatically supports the new system without requiring changes.
  2. The file maintains its adherence to the coding guidelines for libs/** files:
    • Uses TypeScript for type safety.
    • Exports functions and types for reuse across different NextJS apps.
    • Supports effective tree-shaking and bundling.

No further changes are required in this file to support the new pension type.

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 36.75%. Comparing base (d1c22d8) to head (ce13c83).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...suranceAdministration/PensionCalculatorResults.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16450      +/-   ##
==========================================
- Coverage   36.75%   36.75%   -0.01%     
==========================================
  Files        6835     6835              
  Lines      141330   141332       +2     
  Branches    40238    40248      +10     
==========================================
- Hits        51949    51947       -2     
- Misses      89381    89385       +4     
Flag Coverage Δ
air-discount-scheme-backend 54.08% <ø> (ø)
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (ø)
api-domains-air-discount-scheme 36.93% <ø> (ø)
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 48.48% <ø> (ø)
api-domains-communications 39.90% <ø> (ø)
api-domains-criminal-record 48.00% <ø> (ø)
api-domains-driving-license 44.43% <ø> (ø)
api-domains-education 31.58% <ø> (ø)
api-domains-health-insurance 34.77% <ø> (ø)
api-domains-mortgage-certificate 34.95% <ø> (ø)
api-domains-payment-schedule 41.16% <ø> (ø)
application-api-files 56.86% <ø> (ø)
application-core 71.32% <ø> (+0.08%) ⬆️
application-system-api 41.37% <ø> (ø)
application-template-api-modules 27.85% <ø> (ø)
application-templates-accident-notification 29.27% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.34% <ø> (ø)
application-templates-driving-license 18.32% <ø> (ø)
application-templates-estate 12.32% <ø> (ø)
application-templates-example-payment 25.14% <ø> (ø)
application-templates-financial-aid 15.50% <ø> (ø)
application-templates-general-petition 23.44% <ø> (ø)
application-templates-inheritance-report 6.49% <ø> (ø)
application-templates-marriage-conditions 15.17% <ø> (ø)
application-templates-mortgage-certificate 43.82% <ø> (ø)
application-templates-parental-leave 29.96% <ø> (ø)
application-types 6.63% <ø> (ø)
application-ui-components 1.28% <ø> (ø)
application-ui-shell 21.37% <ø> (ø)
auth-react 22.77% <ø> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.67% <ø> (ø)
clients-driving-license-book 43.80% <ø> (ø)
clients-financial-statements-inao 49.32% <ø> (ø)
clients-license-client 1.83% <ø> (ø)
clients-middlewares 73.09% <ø> (+0.25%) ⬆️
clients-regulations 42.80% <ø> (ø)
clients-rsk-company-registry 29.76% <ø> (ø)
clients-syslumenn 49.44% <ø> (ø)
cms 0.42% <ø> (ø)
cms-translations 39.03% <ø> (ø)
contentful-apps 5.44% <ø> (ø)
download-service 44.22% <ø> (ø)
financial-aid-backend 56.37% <ø> (ø)
financial-aid-shared 18.94% <ø> (ø)
island-ui-core 28.39% <ø> (ø)
judicial-system-api 18.36% <ø> (ø)
judicial-system-backend 55.15% <ø> (ø)
judicial-system-web 27.91% <ø> (ø)
license-api 42.67% <ø> (-0.02%) ⬇️
portals-admin-regulations-admin 1.85% <ø> (ø)
portals-core 16.15% <ø> (ø)
services-auth-admin-api 51.93% <ø> (ø)
services-auth-delegation-api 57.30% <ø> (-0.07%) ⬇️
services-auth-ids-api 51.40% <ø> (-0.02%) ⬇️
services-auth-personal-representative 45.14% <ø> (ø)
services-auth-personal-representative-public 41.27% <ø> (+0.01%) ⬆️
services-auth-public-api 48.90% <ø> (ø)
services-endorsements-api 53.66% <ø> (ø)
services-university-gateway 48.42% <ø> (+0.05%) ⬆️
services-user-notification 47.02% <ø> (+0.02%) ⬆️
services-user-profile 62.12% <ø> (+0.09%) ⬆️
shared-components 27.65% <ø> (ø)
shared-form-fields 31.59% <ø> (ø)
shared-utils 27.69% <ø> (ø)
web 1.82% <0.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
...suranceAdministration/PensionCalculatorResults.tsx 0.00% <0.00%> (ø)

... and 1 file 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 18b2931...ce13c83. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Oct 17, 2024

Datadog Report

All test runs 8465e26 🔗

68 Total Test Services: 0 Failed, 65 Passed
🔻 Test Sessions change in coverage: 2 decreased, 4 increased, 194 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 81 0 25.02s N/A Link
air-discount-scheme-web 0 0 0 2 0 7.72s N/A Link
api 0 0 0 4 0 2.98s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 19.34s N/A Link
api-domains-assets 0 0 0 3 0 12.21s N/A Link
api-domains-auth-admin 0 0 0 18 0 13.6s N/A Link
api-domains-communications 0 0 0 5 0 30.88s N/A Link
api-domains-criminal-record 0 0 0 5 0 9.45s 1 no change Link
api-domains-driving-license 0 0 0 23 0 28.68s N/A Link
api-domains-education 0 0 0 8 0 19.49s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (2)

  • services-auth-delegation-api - jest 51.22% (-0.19%) - Details
  • services-auth-ids-api - jest 45.01% (-0.01%) - Details

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.

3 participants