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(parental-leave): ApplicationRights #15901

Merged
merged 16 commits into from
Oct 7, 2024

Conversation

helgifr
Copy link
Member

@helgifr helgifr commented Sep 5, 2024

Added applicationRights to parental-leave when sending application. Since we are using a new way of calculating periods

...

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 constant for parental leave rights descriptions in Icelandic.
    • Added utility functions for calculating personal days and converting them into months.
    • Enhanced configuration capabilities with a new property for application rights.
  • Bug Fixes

    • Improved error handling in parental leave service for missing data.
  • Refactor

    • Streamlined methods for creating rights and periods in the parental leave service.
    • Updated test cases for better clarity and specificity regarding parental leave rights.

Copy link
Contributor

coderabbitai bot commented Sep 5, 2024

Walkthrough

The changes introduce enhancements to the parental leave module, including the addition of a new constant for parental leave rights descriptions in Icelandic, modifications to the ParentalLeaveService for better handling of rights and periods, and the introduction of new utility functions for calculating personal days. The updates also extend the configuration capabilities in the client settings to accommodate application rights, improving the overall structure and functionality of the parental leave application process.

Changes

Files Change Summary
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/constants.ts Added a new exported constant rightsDescriptions for mapping parental leave rights to descriptions in Icelandic.
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.spec.ts Updated test cases for ParentalLeaveService to reflect changes in rights codes and period structures. Modified createPeriodsDTO and createRightsDTO methods to enhance validation and output expectations.
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts Removed getCalculatedPeriod method and refactored createRightsDTO to improve rights and period calculations. Enhanced error handling and logic for managing parental leave rights, including single parent and multiple births scenarios. Added calculatePeriodDays method for better period calculations.
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.utils.ts Introduced an optional applicationRights parameter in transformApplicationToParentalLeaveDTO to enhance data transformation capabilities.
libs/application/templates/parental-leave/src/lib/parentalLeaveUtils.ts Added utility functions getPersonalDays, getPersonalDaysInMonths, and getTransferredDaysInMonths for calculating personal days and converting them into months.
libs/clients/vmst/src/clientConfig.yaml Added a new property applicationRights to the configuration schema to allow specifying application rights.
libs/clients/vmst/src/lib/utils.ts Introduced applicationRights property in the Init type and included it in the createWrappedFetchWithLogging function for improved logging and permission management.

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • ylfahfa
  • veronikasif
  • Toti91

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 Sep 5, 2024

Codecov Report

Attention: Patch coverage is 87.17949% with 10 lines in your changes missing coverage. Please review.

Project coverage is 36.82%. Comparing base (618f23f) to head (5ce2c00).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...templates/parental-leave/parental-leave.service.ts 86.53% 7 Missing ⚠️
...es/parental-leave/src/fields/Duration/Duration.tsx 0.00% 1 Missing ⚠️
...arental-leave/src/lib/directorateOfLabour.utils.ts 50.00% 1 Missing ⚠️
...lates/parental-leave/src/lib/parentalLeaveUtils.ts 95.45% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15901      +/-   ##
==========================================
- Coverage   36.87%   36.82%   -0.06%     
==========================================
  Files        6798     6790       -8     
  Lines      140568   140687     +119     
  Branches    39979    40000      +21     
==========================================
- Hits        51838    51803      -35     
- Misses      88730    88884     +154     
Flag Coverage Δ
air-discount-scheme-backend 54.23% <ø> (ø)
air-discount-scheme-web 0.00% <ø> (ø)
api 3.37% <ø> (ø)
api-domains-air-discount-scheme 36.98% <ø> (ø)
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 48.77% <ø> (ø)
api-domains-communications 39.92% <ø> (ø)
api-domains-criminal-record 47.96% <ø> (ø)
api-domains-driving-license 44.50% <ø> (ø)
api-domains-education 31.44% <ø> (ø)
api-domains-health-insurance 34.83% <ø> (ø)
api-domains-mortgage-certificate 35.74% <ø> (ø)
api-domains-payment-schedule 41.25% <ø> (ø)
application-api-files 57.94% <ø> (ø)
application-core 71.62% <ø> (+0.32%) ⬆️
application-system-api 41.68% <10.38%> (+0.09%) ⬆️
application-template-api-modules 24.30% <87.01%> (+<0.01%) ⬆️
application-templates-accident-notification 29.44% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 26.63% <ø> (ø)
application-templates-driving-license 18.63% <ø> (ø)
application-templates-estate 12.32% <ø> (ø)
application-templates-example-payment 25.41% <ø> (ø)
application-templates-financial-aid 14.34% <ø> (ø)
application-templates-general-petition 23.68% <ø> (ø)
application-templates-health-insurance 26.62% <ø> (ø)
application-templates-inheritance-report 6.45% <ø> (ø)
application-templates-marriage-conditions 15.23% <ø> (ø)
application-templates-mortgage-certificate 43.96% <ø> (ø)
application-templates-parental-leave 30.03% <36.00%> (-0.12%) ⬇️
application-types 6.71% <ø> (ø)
application-ui-components 1.28% <ø> (ø)
application-ui-shell 21.27% <ø> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-driving-license 40.77% <ø> (ø)
clients-driving-license-book 43.93% <ø> (ø)
clients-financial-statements-inao 49.29% <ø> (ø)
clients-license-client 1.83% <ø> (ø)
clients-regulations 42.76% <ø> (ø)
clients-rsk-company-registry 29.76% <ø> (ø)
clients-rsk-personal-tax-return 38.00% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.67% <ø> (ø)
cms 0.43% <ø> (ø)
cms-translations 39.05% <ø> (ø)
dokobit-signing 63.29% <ø> (ø)
download-service 44.11% <ø> (ø)
email-service 61.05% <ø> (ø)
feature-flags 91.04% <ø> (ø)
file-storage 53.59% <ø> (ø)
financial-aid-backend 56.54% <ø> (ø)
judicial-system-api 18.22% <ø> (ø)
judicial-system-audit-trail 69.27% <ø> (ø)
judicial-system-backend 55.19% <ø> (ø)
judicial-system-message 67.18% <ø> (ø)
judicial-system-message-handler 48.26% <ø> (ø)
judicial-system-scheduler 69.39% <ø> (ø)
license-api 42.63% <ø> (-0.06%) ⬇️
nest-config 78.38% <ø> (ø)
nest-feature-flags 52.02% <ø> (ø)
nova-sms 62.65% <ø> (ø)
portals-admin-regulations-admin 1.88% <ø> (ø)
portals-core 16.15% <ø> (ø)
services-auth-admin-api 51.99% <ø> (ø)
services-auth-delegation-api 57.94% <ø> (+0.06%) ⬆️
services-auth-ids-api 51.89% <ø> (+<0.01%) ⬆️
services-auth-personal-representative 45.53% <ø> (-0.03%) ⬇️
services-auth-personal-representative-public 41.55% <ø> (-0.10%) ⬇️
services-auth-public-api 49.38% <ø> (ø)
services-endorsements-api 55.23% <ø> (ø)
services-sessions 65.81% <ø> (ø)
services-university-gateway 48.54% <ø> (+0.08%) ⬆️
services-user-notification 47.07% <ø> (ø)
services-user-profile 62.37% <ø> (+0.07%) ⬆️
testing-e2e 66.66% <ø> (ø)
web 1.83% <ø> (ø)

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

Files with missing lines Coverage Δ
.../lib/modules/templates/parental-leave/constants.ts 100.00% <100.00%> (ø)
...s/templates/parental-leave/parental-leave.utils.ts 83.04% <ø> (-0.44%) ⬇️
libs/clients/vmst/src/lib/utils.ts 18.51% <ø> (ø)
...es/parental-leave/src/fields/Duration/Duration.tsx 0.00% <0.00%> (ø)
...arental-leave/src/lib/directorateOfLabour.utils.ts 91.59% <50.00%> (-0.72%) ⬇️
...lates/parental-leave/src/lib/parentalLeaveUtils.ts 55.93% <95.45%> (+0.32%) ⬆️
...templates/parental-leave/parental-leave.service.ts 45.59% <86.53%> (-2.70%) ⬇️

... and 50 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 618f23f...5ce2c00. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Sep 5, 2024

Datadog Report

All test runs 6862131 🔗

70 Total Test Services: 0 Failed, 68 Passed
🔻 Test Sessions change in coverage: 3 decreased, 3 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 22.01s N/A Link
air-discount-scheme-web 0 0 0 2 0 7.68s N/A Link
api 0 0 0 4 0 2.82s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 19.32s N/A Link
api-domains-assets 0 0 0 3 0 12.15s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 12.46s N/A Link
api-domains-communications 0 0 0 5 0 29.08s 1 no change Link
api-domains-criminal-record 0 0 0 5 0 9.02s 1 no change Link
api-domains-driving-license 0 0 0 23 0 29.87s 1 no change Link
api-domains-education 0 0 0 8 0 20.56s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (3)

  • application-templates-parental-leave - jest 35.24% (-0.17%) - Details
  • services-auth-personal-representative - jest 44.05% (-0.02%) - Details
  • application-template-api-modules - jest 26.02% (-0.01%) - Details

@helgifr helgifr force-pushed the feat/parental-leave-periods-applicationRights branch from 2a2591d to a0124a4 Compare September 6, 2024 16:34
@helgifr helgifr marked this pull request as ready for review September 17, 2024 13:50
@helgifr helgifr requested a review from a team as a code owner September 17, 2024 13:50
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: 13

Outside diff range and nitpick comments (4)
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.spec.ts (1)

285-398: Consistency in test descriptions

Ensure that the test descriptions accurately and consistently reflect the test cases. For example, standardize the capitalization in 'multiple Birth' to 'multiple birth' for clarity.

libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts (1)

900-908: Avoid redundant calculation of rights

The variable rights is derived from rightsDTO, which is already available. Ensure that re-mapping rightsDTO to get rights is necessary and optimized.

If rightsUnit is the only property needed, consider optimizing this step to improve performance for large datasets.

libs/application/templates/parental-leave/src/lib/parentalLeaveUtils.ts (2)

257-276: Add unit tests for the new utility functions

The newly added functions getPersonalDays, getPersonalDaysInMonths, and getTransferredDaysInMonths are critical for calculating parental leave entitlements. To ensure their correctness and prevent future regressions, please add corresponding unit tests.

Also applies to: 278-279, 424-427


271-274: Ensure variables are properly typed to avoid implicit any type

The variables used in the calculation may be implicitly of type any. Consider explicitly typing maximumDaysToSpend, maximumAdditionalSingleParentDaysToSpend, maximumMultipleBirthsDaysToSpend, and transferredDays to enhance type safety.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9aaa6b1 and b3166be.

Files selected for processing (7)
  • libs/application/template-api-modules/src/lib/modules/templates/parental-leave/constants.ts (1 hunks)
  • libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.spec.ts (1 hunks)
  • libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts (8 hunks)
  • libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.utils.ts (3 hunks)
  • libs/application/templates/parental-leave/src/lib/parentalLeaveUtils.ts (2 hunks)
  • libs/clients/vmst/src/clientConfig.yaml (1 hunks)
  • libs/clients/vmst/src/lib/utils.ts (3 hunks)
Additional context used
Path-based instructions (7)
libs/clients/vmst/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."
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/constants.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/parental-leave/parental-leave.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."
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.spec.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/clients/vmst/src/clientConfig.yaml (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/parental-leave/parental-leave.service.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/parental-leave/src/lib/parentalLeaveUtils.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."
Biome
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.utils.ts

[error] 467-468: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

Additional comments not posted (12)
libs/clients/vmst/src/lib/utils.ts (3)

5-5: Importing 'ApplicationRights'

The ApplicationRights type is correctly imported from '../../gen/fetch', enabling its usage within this module.


51-51: Adding 'applicationRights' to 'Init' type

Including applicationRights: ApplicationRights[] in the Init type extends the data structure to accommodate application rights, which aligns with the PR objective of integrating new calculation methods.


84-84: Ensure 'applicationRights' does not expose sensitive data in logs

Adding applicationRights to the list of picked attributes for logging might unintentionally include sensitive information. Please verify that the fields within applicationRights are safe to log and do not contain Personally Identifiable Information (PII) or confidential data.

Run the following script to inspect the fields of ApplicationRights and ensure they do not contain sensitive data:

Verification successful

Logging 'applicationRights' appears safe, but exercise caution

Based on the examination of the 'ApplicationRights' model, it doesn't contain inherently sensitive information. The fields (rightsUnit, rightsDescription, months, days, daysLeft) are general descriptors and time-related data, not personal or confidential information.

However, to maintain best practices in data privacy:

  • Consider logging only necessary fields from 'applicationRights' rather than the entire object.
  • Conduct a runtime review to ensure no sensitive information is inadvertently stored in these fields during actual use.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Inspect the fields of 'ApplicationRights' to verify they do not contain sensitive information.

# Search for the definition of 'ApplicationRights' interface
ast-grep --lang ts --pattern 'export interface ApplicationRights { $$$ }'

Length of output: 75


Script:

#!/bin/bash
# Search for any mention of 'ApplicationRights' in the codebase
rg "ApplicationRights" -n

# Search for type definitions or interfaces that might be related to 'ApplicationRights'
ast-grep --lang ts --pattern 'type $_ = { $$$ applicationRights $$$ }'
ast-grep --lang ts --pattern 'interface $_ { $$$ applicationRights $$$ }'

# Search for usages of 'applicationRights' to understand its structure
rg "applicationRights" -n -A 5

Length of output: 10559


Script:

#!/bin/bash
# View the contents of the ApplicationRights model
cat libs/api/domains/directorate-of-labour/src/models/applicationRights.model.ts

# Search for usage of ApplicationRights in logging contexts
rg "ApplicationRights.*log" -n

# Search for comments near ApplicationRights that might indicate sensitivity
rg "ApplicationRights" -n -C 3 | rg "sensitive|private|confidential" -n

Length of output: 513

libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.utils.ts (4)

31-31: Importing ApplicationRights

The addition of ApplicationRights to the imports ensures that the type is available for use within the module. This aligns with the PR objective of integrating application rights into the parental leave application process.


375-375: Updating Function Signature with applicationRights

The transformApplicationToParentalLeaveDTO function now includes an optional parameter applicationRights?: ApplicationRights[]. This enhancement allows the function to handle application rights, supporting the new calculation method as per the PR objectives.


468-468: Including applicationRights in Return Object

Adding applicationRights to the return object integrates the application rights into the DTO, which is essential for the new calculation method. This change is appropriate and necessary for the functionality enhancement.

Tools
Biome

[error] 467-468: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)


375-375: Verify Function Calls are Updated

With the updated function signature, please ensure that all calls to transformApplicationToParentalLeaveDTO throughout the codebase are updated to include the new applicationRights parameter where necessary.

You can run the following script to identify all usages of the function and check if they include the applicationRights parameter:

libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.spec.ts (4)

296-297: Ensure correct data types for multipleBirthsRequestDays and multipleBirths

The properties multipleBirthsRequestDays and multipleBirths are set with numeric values. Please verify that these fields are intended to be numbers and that downstream code handles these numeric values correctly.


304-322: Validate the calculations for days, daysLeft, and months in test expectations

The expected values for days, daysLeft, and months should accurately reflect the application's logic. For instance, verify that months: '12' corresponds correctly to days: '180' in the context of the rights being tested.


348-350: Confirm accuracy of daysLeft and months for multiple births

In the test case for multiple births, ensure that the daysLeft and months values correctly represent the calculations based on multipleBirthsRequestDays. Specifically, check that daysLeft: '34' and months: '3' are accurate for days: '79'.


375-380: Add missing properties in the period object

The period object set at answers.periods[0] lacks the endDate property. This might lead to issues when the application processes periods without an endDate.

Apply this change to include the missing endDate:

 set(application, 'answers.periods[0]', {
   ratio: '100',
   useLength: 'no',
   startDate: '2025-03-12',
+  endDate: '2025-09-14',
 })

Likely invalid or redundant comment.

libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts (1)

93-93: Imported parseISO for date parsing

The import of parseISO from 'date-fns' is appropriate for parsing ISO date strings.

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 b3166be and 57ced94.

Files selected for processing (2)
  • libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts (8 hunks)
  • libs/application/templates/parental-leave/src/lib/parentalLeaveUtils.ts (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • libs/application/templates/parental-leave/src/lib/parentalLeaveUtils.ts
Additional context used
Path-based instructions (1)
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.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."

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 57ced94 and bf34b42.

Files selected for processing (1)
  • libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts (8 hunks)
Additional context used
Path-based instructions (1)
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.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/parental-leave/parental-leave.service.ts (1)

827-841: Ensure proper error handling for invalid inputs in calculatePeriodDays

The calculatePeriodDays function lacks input validation for startDate, endDate, and ratio. Invalid or improperly formatted inputs could lead to unexpected errors, such as Invalid Date objects or NaN values.

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 bf34b42 and f88cc14.

Files selected for processing (2)
  • libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts (8 hunks)
  • libs/clients/vmst/src/clientConfig.yaml (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • libs/clients/vmst/src/clientConfig.yaml
Additional context used
Path-based instructions (1)
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.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."
Biome
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts

[error] 838-838: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)


[error] 838-838: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)


[error] 842-842: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.

See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.

(lint/suspicious/noGlobalIsNan)

Additional comments not posted (2)
libs/application/template-api-modules/src/lib/modules/templates/parental-leave/parental-leave.service.ts (2)

754-768: Great job eliminating code duplication with addMultipleBirthsRights

Refactoring repeated logic into the addMultipleBirthsRights helper function improves code maintainability and clarity.


878-892: Successfully refactored shared logic into preparePeriodsAndRightsDTO

Extracting common code into preparePeriodsAndRightsDTO enhances modularity and reduces duplication across sendApplication and validateApplication methods.

@helgifr helgifr force-pushed the feat/parental-leave-periods-applicationRights branch from 8b84e0b to 65c69d7 Compare September 19, 2024 13:21
@helgifr helgifr force-pushed the feat/parental-leave-periods-applicationRights branch from 87138b8 to bdfc6b0 Compare September 24, 2024 16:27
@helgifr helgifr force-pushed the feat/parental-leave-periods-applicationRights branch from 712b849 to 217edc9 Compare September 27, 2024 16:12
@ylfahfa ylfahfa requested a review from veronikasif October 3, 2024 11:59
Copy link
Member

@ylfahfa ylfahfa left a comment

Choose a reason for hiding this comment

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

lgtm 👍 Veronika will do a follow-up review.

Copy link
Member

@veronikasif veronikasif left a comment

Choose a reason for hiding this comment

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

lgtm 🥇

@veronikasif veronikasif added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Oct 7, 2024
@kodiakhq kodiakhq bot merged commit 8c77303 into main Oct 7, 2024
200 checks passed
@kodiakhq kodiakhq bot deleted the feat/parental-leave-periods-applicationRights branch October 7, 2024 16:54
thordurhhh pushed a commit that referenced this pull request Oct 8, 2024
* feat(parental-leave): ApplicationRights

Added applicationRights to parental-leave when sending application. Since we are using a new way of calculating periods

* Fix days used by period calculation

* Tests for new periods

* rename function with proper camelCase

* Refactor: Made duplicate code into a function

* Make ApplicationRights nullable

* refactor: function instead of duplicate code

* remove console.log

* error handling for period data

* clientConfig nullable fix

* Fixes for calculation of months. And using clamp to get correct value of daysLeft

* Multiply amount of months by 30 for period calculation with month durations

* Fix old calculation of endDate with months

---------

Co-authored-by: hfhelgason <[email protected]>
Co-authored-by: veronikasif <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
kodiakhq bot added a commit that referenced this pull request Oct 11, 2024
…-pages (#16234)

* Service portal removal. Add portals my pages

* minor fixes

* Fix

* path fix

* fix(portals-admin): locklist (#16279)

* fix(portals-admin): locklist

* tweak

* msg id fix

* tweak

---------

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

* feat(service-portal): feature flag resolver for documents (#16285)

* fix: def info and alert

* feat: add feature flag to resolver

* fix: move ff call to seperate function

---------

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

* fix(vehicles-bulk-mileage): Fixes after testing review (#16295)

* fix: testing fixes v1

* fix: testing comments v2

* fix: better message

* fix: function name

* fix: duplicate loading

---------

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

* feat(tests): New @island/testing/e2e library (#16287)

* Add @swc-node/register and @swc/core

* Add testing/e2e library

* update project.json for testing/e2e

* fix import for libTestingE2e

---------

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

* feat(parental-leave): ApplicationRights (#15901)

* feat(parental-leave): ApplicationRights

Added applicationRights to parental-leave when sending application. Since we are using a new way of calculating periods

* Fix days used by period calculation

* Tests for new periods

* rename function with proper camelCase

* Refactor: Made duplicate code into a function

* Make ApplicationRights nullable

* refactor: function instead of duplicate code

* remove console.log

* error handling for period data

* clientConfig nullable fix

* Fixes for calculation of months. And using clamp to get correct value of daysLeft

* Multiply amount of months by 30 for period calculation with month durations

* Fix old calculation of endDate with months

---------

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

* feat(passport-application): Updated readme (#16296)

* updated readme

* updated readme

* chore: nx format:write update dirty files

---------

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

* fix(regulations-admin): date format signature, remove self affect, disclaimer text (#16288)

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

* fix(regulations-admin): No diff no addition in appendix (#16293)

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

* fix(web): Global alert banner - Handle null case (#16298)

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

* fix(web): Change custom syslumenn pages config for header (#16299)

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

* fix(j-s): Digital mailbox API (#16301)

* feat(j-s): Block create subpoena on staging and dev

* Update subpoena.service.ts

* fix(j-s): Fix mailbox API

* remove changes not meant for this branch

* Update subpoena.service.ts

* fix(j-s): reverting changes from other branch

* Update subpoena.response.ts

* Update subpoena.response.ts

* Update subpoena.response.ts

* Update subpoena.response.ts

---------

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

* fix(signature-collection): Fix list reviewed toggle (#16300)

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

* chore(scripts): Stricter shell script checking (#16242)

* Set style level for shellcheck

* Linting & formatting scripts

* Remove _podman.sh script

* Format all scripts

* Add reviewdog/action-shfmt step

* Configure shfmt

* Merge from main

* Linting

* Move shfmt to before lint

* Remove reviewdog

* Allow external sources in shellcheck

* Use Reviewdog for shellcheck

* Set version for Reviewdog

---------

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

* chore(new-primary-school): Update messages namespace (#16302)

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

* feat(driving-license): check if 65+ renewal is possible (#16292)

* check if 65 renewal is possible

* remove console log

* cleanup

* coderabbit tweaks

* coderabbit changes

* quick fix

* add type?

---------

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

* feat(service-portal): default defender and has chosen fields for subpoena (#16306)

* fix: def info and alert

* feat: add feature flag to resolver

* fix: move ff call to seperate function

* feat: add default choices ans has chosen + loading states

* fix: use type

* fix: undefined type issue

* fix: simplify check

* Update service setup for my pages infra

* chore: charts update dirty files

* Remove from infra

* undo rename

---------

Co-authored-by: albinagu <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Ásdís Erna Guðmundsdóttir <[email protected]>
Co-authored-by: Þorkell Máni Þorkelsson <[email protected]>
Co-authored-by: Svanhildur Einarsdóttir <[email protected]>
Co-authored-by: Kristofer <[email protected]>
Co-authored-by: helgifr <[email protected]>
Co-authored-by: hfhelgason <[email protected]>
Co-authored-by: veronikasif <[email protected]>
Co-authored-by: Rafn Árnason <[email protected]>
Co-authored-by: andes-it <[email protected]>
Co-authored-by: Rúnar Vestmann <[email protected]>
Co-authored-by: mannipje <[email protected]>
Co-authored-by: unakb <[email protected]>
Co-authored-by: juni-haukur <[email protected]>
Co-authored-by: birkirkristmunds <[email protected]>
Co-authored-by: Kristján Albert <[email protected]>
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