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(new-primary-school): Use guardian role instead of parent #17269

Merged
merged 3 commits into from
Dec 17, 2024

Conversation

helgifr
Copy link
Member

@helgifr helgifr commented Dec 17, 2024

...

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

    • Updated role designation for parents to 'guardian' in application templates for primary schools.
  • Bug Fixes

    • Ensured consistent role assignment for both parent entries in the application process.

@helgifr helgifr requested a review from a team as a code owner December 17, 2024 13:25
@helgifr helgifr added the automerge Merge this PR as soon as all checks pass label Dec 17, 2024
Copy link
Contributor

coderabbitai bot commented Dec 17, 2024

Walkthrough

The pull request introduces a minor modification to the transformApplicationToNewPrimarySchoolDTO function in the new-primary-school.utils.ts file. The key change is updating the role designation for parents from 'parent' to 'guardian' in the agents array. This affects both parents.parent1 and parents.parent2, ensuring a consistent 'guardian' role assignment. The core logic of the function remains unchanged, with no alterations to error handling or data processing mechanisms.

Changes

File Change Summary
libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts Updated parent role from 'parent' to 'guardian' in the transformApplicationToNewPrimarySchoolDTO function

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • birkirkristmunds

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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
Member

@birkirkristmunds birkirkristmunds left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

codecov bot commented Dec 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 35.72%. Comparing base (7e8c82f) to head (6070a07).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17269      +/-   ##
==========================================
- Coverage   35.72%   35.72%   -0.01%     
==========================================
  Files        6944     6944              
  Lines      148493   148493              
  Branches    42381    42386       +5     
==========================================
- Hits        53043    53042       -1     
- Misses      95450    95451       +1     
Flag Coverage Δ
air-discount-scheme-web 0.00% <ø> (ø)
api 3.33% <ø> (ø)
api-domains-auth-admin 48.49% <ø> (ø)
api-domains-communications 39.42% <ø> (ø)
application-api-files 61.87% <ø> (ø)
application-core 75.78% <ø> (ø)
application-system-api 38.74% <ø> (-0.01%) ⬇️
application-template-api-modules 27.82% <ø> (-0.01%) ⬇️
application-templates-accident-notification 28.82% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 25.77% <ø> (ø)
application-templates-driving-license 18.16% <ø> (ø)
application-templates-estate 13.69% <ø> (ø)
application-templates-example-payment 24.72% <ø> (ø)
application-templates-financial-aid 14.46% <ø> (ø)
application-templates-general-petition 23.15% <ø> (ø)
application-templates-inheritance-report 6.59% <ø> (ø)
application-templates-marriage-conditions 15.19% <ø> (ø)
application-templates-mortgage-certificate 43.64% <ø> (ø)
application-templates-parental-leave 29.94% <ø> (ø)
application-types 6.51% <ø> (ø)
application-ui-components 1.22% <ø> (ø)
application-ui-shell 22.32% <ø> (ø)
clients-charge-fjs-v2 28.35% <ø> (ø)
cms 0.39% <ø> (ø)
cms-translations 38.75% <ø> (ø)
contentful-apps 4.72% <ø> (ø)
financial-aid-backend 51.40% <ø> (ø)
financial-aid-shared 17.88% <ø> (ø)
island-ui-core 30.40% <ø> (ø)
judicial-system-api 20.21% <ø> (ø)
judicial-system-backend 55.91% <ø> (ø)
judicial-system-web 27.77% <ø> (ø)
portals-admin-regulations-admin 1.80% <ø> (ø)
portals-core 19.61% <ø> (ø)
services-user-notification 46.54% <ø> (-0.01%) ⬇️
shared-components 29.64% <ø> (-0.42%) ⬇️
shared-form-fields 33.30% <ø> (ø)
web 2.41% <ø> (ø)

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

Files with missing lines Coverage Δ
...tes/new-primary-school/new-primary-school.utils.ts 12.50% <ø> (ø)

... 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 7e8c82f...6070a07. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Dec 17, 2024

Datadog Report

All test runs d557f36 🔗

38 Total Test Services: 0 Failed, 35 Passed
🔻 Test Sessions change in coverage: 1 decreased (-0.58%), 170 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-web 0 0 0 2 0 7.63s 1 no change Link
api 0 0 0 4 0 2.72s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 12.48s 1 no change Link
api-domains-communications 0 0 0 5 0 32.99s 1 no change Link
api-domains-license-service 0 0 0 0 0 515.45ms 1 no change Link
application-api-files 0 0 0 2 0 4.93s 1 no change Link
application-core 0 0 0 97 0 19.63s 1 no change Link
application-system-api 0 0 0 46 0 2m 13.28s 1 no change Link
application-template-api-modules 0 0 0 118 0 2m 30.97s 1 no change Link
application-templates-accident-notification 0 0 0 148 0 19.1s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (1)

  • shared-components - jest 37.03% (-0.58%) - Details

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/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts (2)

Line range hint 1-168: Consider enhancing type safety for role strings.

While the implementation is functional, we could improve type safety by defining an enum or union type for the agent roles to prevent potential typos and ensure consistency across the codebase.

Consider adding a type definition like this:

export type AgentRole = 'guardian' | 'sibling' | /* other valid roles */;

Then update the AgentDto interface to use this type:

interface AgentDto {
  // ... other fields
  role: AgentRole;
}

Line range hint 76-85: TODO comments need attention.

There are two TODO comments regarding reason validation and sibling relation options that should be addressed:

  1. Validation of selected reasons
  2. Missing sibling relation options in key-options endpoint

Would you like me to help create GitHub issues to track these TODOs?

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b280879 and 1785dfa.

📒 Files selected for processing (1)
  • libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
libs/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.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/application/template-api-modules/src/lib/modules/templates/new-primary-school/new-primary-school.utils.ts (2)

49-49: LGTM! Role designation change is consistent and appropriate.

The change from 'parent' to 'guardian' is applied consistently for both parent1 and parent2, which aligns with the PR objectives and provides more inclusive terminology.

Also applies to: 62-62


Line range hint 1-168: Verify the impact of role change on the MMS/Frigg client.

Since this change modifies the role value sent to the FormDto/AgentDto from the MMS/Frigg client, we should verify that the 'guardian' role is properly handled by the API.

✅ Verification successful

Let me verify the role value change by searching for role-related code in the codebase.


Let me search for more context about the AgentDto interface and role handling.


Based on the search results, I can see that the role value 'guardian' is being used consistently in the new primary school application template, and there is no validation or role-specific logic in the MMS/Frigg client that would be impacted by this role value. The role is simply passed through as a string value in the AgentDto.

The change from 'parent' to 'guardian' role is safe to proceed with.

The evidence shows:

  1. The role 'guardian' is already being used in the same file for both parent1 and parent2
  2. No role validation or role-specific logic exists in the MMS/Frigg client
  3. The role is used purely for identification purposes in the DTO
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for role validation or role-specific logic in the MMS/Frigg client code
ast-grep --pattern 'interface AgentDto {
  $$$
  role: $_
  $$$
}'

# Search for any hardcoded 'parent' role references that might need updating
rg -i "role.*['\"]parent['\"]" 

Length of output: 131070


Script:

#!/bin/bash
# Search for role validation or role-specific logic in the MMS/Frigg client
rg -A 2 -B 2 "role.*['\"]guardian['\"]"

# Search for AgentDto interface definition
rg -A 5 "interface AgentDto"

Length of output: 1465


Script:

#!/bin/bash
# Search for AgentDto type definitions and imports
rg -A 5 "from '@island.is/clients/mms/frigg'"

# Search for any role-related validation or type definitions
rg -A 5 "type.*Role|enum.*Role|interface.*Role"

# Search for role property usage in tests
rg -A 2 "role: ['\"](parent|guardian)['\"]" "**/*.spec.ts" "**/*.test.ts"

Length of output: 66756

@helgifr helgifr added the high priority VIP-Kodiak PR label Dec 17, 2024
@helgifr helgifr removed the high priority VIP-Kodiak PR label Dec 17, 2024
@kodiakhq kodiakhq bot merged commit 9891a9b into main Dec 17, 2024
140 checks passed
@kodiakhq kodiakhq bot deleted the fix/mms-guardian-instead-of-parent branch December 17, 2024 20:23
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