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(driving-instructor-registrations): Add tabs for B and BE license #14609

Merged
merged 10 commits into from
Jun 11, 2024

Conversation

juni-haukur
Copy link
Member

@juni-haukur juni-haukur commented Apr 24, 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

    • Introduced TeacherRights interface to manage teacher permissions and details.
    • Added support for licenseCategory parameter in various components and services, enabling better categorization and filtering of driving students and lessons.
  • Enhancements

    • Improved StudentsOverview component with tabs for different license categories, enhancing user experience.
    • Updated GraphQL queries and service methods to include licenseCategory for more specific data retrieval.
  • Documentation

    • Added new message definitions related to tab titles and registration pages for different license types.

Copy link
Contributor

coderabbitai bot commented Apr 24, 2024

Walkthrough

The changes introduce a new feature to manage teacher rights and license categories ('B' and 'BE') in the driving license book system. Key updates include adding a TeacherRights interface, modifying GraphQL queries and resolvers to handle license categories, and updating components to display data based on selected license categories. These enhancements aim to provide a more tailored user experience by allowing teachers to manage students based on specific license types.

Changes

File Path Change Summary
libs/api/domains/driving-license-book/src/index.ts Added TeacherRights export alongside Organization.
libs/api/domains/driving-license-book/src/lib/drivingLicenceBook.type.ts Introduced TeacherRights interface with properties active, hasRegisteredDrivingLessons, and rights.
libs/api/domains/driving-license-book/src/lib/drivingLicenseBook.resolver.ts Modified drivingLicenseBookStudentsForTeacher to accept licenseCategory argument.
libs/api/domains/driving-license-book/src/lib/drivingLicenseBook.service.ts Added TeacherRights import, licenseCategory parameter to methods, and getTeacher method.
libs/api/domains/driving-license-book/src/lib/dto/student.input.ts Added optional licenseCategory field to DrivingLicenseBookStudentInput.
libs/api/domains/driving-license-book/src/lib/utils/drivingLicenseBookMapper.ts Updated totalLessonTime calculation in getStudentMapper based on teachersAndLessons data.
libs/application/template-api-modules/src/lib/modules/shared/api/driving-license/driving-license.service.ts Added getTeacherRights method to DrivingLicenseProviderService class.
libs/application/templates/driving-instructor-registrations/src/fields/StudentsOverview/index.tsx Introduced Tabs for license categories, modified useQuery call, and added logic to display tabs based on teacher rights.
libs/application/templates/driving-instructor-registrations/src/fields/ViewStudent/index.tsx Added licenseCategory property to Props interface and component, and modified GraphQL query to include licenseCategory.
libs/application/templates/driving-instructor-registrations/src/forms/instructorRegistrations.ts Added GetTeacherRightsApi data provider item to getInstructorRegistrations function.
libs/application/templates/driving-instructor-registrations/src/graphql/queries.ts Modified InstructorsStudentsQuery to accept licenseCategory parameter.
libs/application/templates/driving-instructor-registrations/src/lib/InstructorRegistrationsTemplate.ts Included GetTeacherRightsApi in api array and externalData array.
libs/application/templates/driving-instructor-registrations/src/lib/messages.ts Added new message definitions for tab titles and registration page title for specific license types.
libs/application/templates/driving-instructor-registrations/src/types/enums.ts Introduced LicenseCategory enum with members B and BE.
libs/application/types/src/lib/template-api/shared-api/shared-api-definitions/driving-license.ts Added GetTeacherRightsApi constant.
libs/clients/driving-license-book/src/lib/drivingLicenseBookClient.service.ts Added TeacherRights and TeacherDetailsGetResponse imports, licenseCategory parameter to methods, and getTeacher method.
libs/clients/driving-license-book/src/lib/drivingLicenseBookType.types.ts Added licenseCategory field to DrivingLicenseBookStudentInput and introduced TeacherRights interface.
libs/clients/driving-license-book/src/utils/mappers.ts Implemented teacherRightsMapper function and updated totalLessonTime calculation in getStudentAndBookMapper.
libs/application/templates/driving-instructor-registrations/src/lib/getApplicationFeatureFlags.ts Introduced getApplicationFeatureFlags function to retrieve feature flags related to driving license applications.

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

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

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

CodeRabbit Commands (invoked as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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 Apr 24, 2024

Codecov Report

Attention: Patch coverage is 20.58824% with 27 lines in your changes missing coverage. Please review.

Project coverage is 37.05%. Comparing base (654266f) to head (e64752e).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #14609      +/-   ##
==========================================
+ Coverage   36.98%   37.05%   +0.06%     
==========================================
  Files        6417     6424       +7     
  Lines      130864   130495     -369     
  Branches    37464    37242     -222     
==========================================
- Hits        48402    48349      -53     
+ Misses      82462    82146     -316     
Flag Coverage Δ
application-api-files 56.20% <100.00%> (+0.02%) ⬆️
application-core 71.87% <100.00%> (+0.11%) ⬆️
application-template-api-modules 24.22% <14.28%> (-0.03%) ⬇️
application-templates-inheritance-report 4.74% <100.00%> (+0.03%) ⬆️

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

Files Coverage Δ
libs/api/domains/driving-license-book/src/index.ts 100.00% <100.00%> (ø)
...ng-license-book/src/lib/drivingLicenceBook.type.ts 100.00% <ø> (ø)
...ared-api/shared-api-definitions/driving-license.ts 100.00% <100.00%> (ø)
...cense-book/src/lib/drivingLicenseBookType.types.ts 100.00% <ø> (ø)
.../driving-license-book/src/lib/dto/student.input.ts 80.00% <50.00%> (-20.00%) ⬇️
...icense-book/src/lib/drivingLicenseBook.resolver.ts 58.82% <33.33%> (-0.71%) ⬇️
...license-book/src/lib/drivingLicenseBook.service.ts 12.00% <0.00%> (-0.77%) ⬇️
...red/api/driving-license/driving-license.service.ts 10.90% <0.00%> (-0.63%) ⬇️
...e-book/src/lib/drivingLicenseBookClient.service.ts 30.06% <12.50%> (-0.96%) ⬇️
.../clients/driving-license-book/src/utils/mappers.ts 28.68% <22.22%> (-1.14%) ⬇️

... and 105 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 654266f...e64752e. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

All test runs 86d28fb 🔗

9 Total Test Services: 0 Failed, 9 Passed
🔻 Test Sessions change in coverage: 1 decreased (-0.38%), 14 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Wall Time Code Coverage Change Test Service View
api 0 0 0 4 0 20.5ms 1 no change Link
application-system-api 0 0 0 111 2 1m 21.46s 1 no change Link
application-template-api-modules 0 0 0 107 0 1m 1.97s 1 no change Link
application-ui-shell 0 0 0 74 0 38.22s 1 no change Link
clients-driving-license-book 0 0 0 5 0 206.36ms 1 decreased (-0.38%) Link
judicial-system-api 0 0 0 52 0 300.88ms 1 no change Link
judicial-system-backend 0 0 0 13273 0 15m 4.02s 1 no change Link
judicial-system-scheduler 0 0 0 5 0 29.24ms 1 no change Link
judicial-system-xrd-api 0 0 0 6 0 69.07ms 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (1)

  • clients-driving-license-book - jest 38.67% (-0.38%) - Details

@andes-it
Copy link
Member

This PR's had a 15-day siesta. Lost its spark, did it? It's making an exit in 5 days unless the stale label disappears.

@andes-it andes-it added stale Issue or pull request is stale and removed stale Issue or pull request is stale labels May 10, 2024
@andes-it
Copy link
Member

This PR's had a 15-day siesta. Lost its spark, did it? It's making an exit in 5 days unless the stale label disappears.

@andes-it andes-it added the stale Issue or pull request is stale label May 26, 2024
@datadog-island-is
Copy link

datadog-island-is bot commented May 29, 2024

Datadog Report

All test runs 6949ad0 🔗

41 Total Test Services: 0 Failed, 39 Passed
🔻 Test Sessions change in coverage: 3 decreased, 10 increased, 111 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
api 0 0 0 4 0 4.89s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 21.94s 1 no change Link
api-domains-communications 0 0 0 5 0 49.39s 1 no change Link
api-domains-education 0 0 0 8 0 32.68s 1 no change Link
api-domains-license-service 0 0 0 0 0 628.22ms 1 no change Link
application-api-files 0 0 0 12 0 11.15s 1 increased (+0.03%) Link
application-system-api 0 0 0 111 2 3m 49.13s 1 decreased (-0.02%) Link
application-template-api-modules 0 0 0 109 0 2m 7.64s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 18.33s 1 increased (+0.13%) Link
application-templates-driving-license 0 0 0 13 0 26.89s 1 increased (+0.09%) Link

🔻 Code Coverage Decreases vs Default Branch (3)

  • clients-driving-license-book - jest 38.42% (-0.53%) - Details
  • application-system-api - jest 37.63% (-0.02%) - Details
  • services-user-profile - jest 52.99% (-0.02%) - Details

@andes-it andes-it removed the stale Issue or pull request is stale label May 30, 2024
@juni-haukur juni-haukur added the deploy-feature Deploys features to dev label May 30, 2024
Copy link
Contributor

github-actions bot commented May 30, 2024

Affected services are: api,application-system-api,air-discount-scheme-web,skilavottord-web,web,application-system-form,island-ui-storybook,portals-admin,service-portal,system-e2e,

@juni-haukur juni-haukur removed the deploy-feature Deploys features to dev label May 30, 2024
@juni-haukur juni-haukur added the deploy-feature Deploys features to dev label Jun 3, 2024
@juni-haukur juni-haukur marked this pull request as ready for review June 7, 2024 09:53
@juni-haukur juni-haukur requested review from a team as code owners June 7, 2024 09:53
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: 3

Outside diff range and nitpick comments (1)
libs/application/templates/driving-instructor-registrations/src/fields/ViewStudent/index.tsx (1)

47-47: Add TypeScript documentation for the new licenseCategory prop.

Consider adding a brief TypeScript comment above the licenseCategory prop to explain its purpose and usage within the component. This enhances maintainability and clarity for other developers.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 46e3ec8 and ed2a464.

Files selected for processing (18)
  • libs/api/domains/driving-license-book/src/index.ts (1 hunks)
  • libs/api/domains/driving-license-book/src/lib/drivingLicenceBook.type.ts (1 hunks)
  • libs/api/domains/driving-license-book/src/lib/drivingLicenseBook.resolver.ts (1 hunks)
  • libs/api/domains/driving-license-book/src/lib/drivingLicenseBook.service.ts (3 hunks)
  • libs/api/domains/driving-license-book/src/lib/dto/student.input.ts (1 hunks)
  • libs/api/domains/driving-license-book/src/lib/utils/drivingLicenseBookMapper.ts (1 hunks)
  • libs/application/template-api-modules/src/lib/modules/shared/api/driving-license/driving-license.service.ts (2 hunks)
  • libs/application/templates/driving-instructor-registrations/src/fields/StudentsOverview/index.tsx (6 hunks)
  • libs/application/templates/driving-instructor-registrations/src/fields/ViewStudent/index.tsx (2 hunks)
  • libs/application/templates/driving-instructor-registrations/src/forms/instructorRegistrations.ts (2 hunks)
  • libs/application/templates/driving-instructor-registrations/src/graphql/queries.ts (1 hunks)
  • libs/application/templates/driving-instructor-registrations/src/lib/InstructorRegistrationsTemplate.ts (2 hunks)
  • libs/application/templates/driving-instructor-registrations/src/lib/messages.ts (1 hunks)
  • libs/application/templates/driving-instructor-registrations/src/types/enums.ts (1 hunks)
  • libs/application/types/src/lib/template-api/shared-api/shared-api-definitions/driving-license.ts (1 hunks)
  • libs/clients/driving-license-book/src/lib/drivingLicenseBookClient.service.ts (6 hunks)
  • libs/clients/driving-license-book/src/lib/drivingLicenseBookType.types.ts (2 hunks)
  • libs/clients/driving-license-book/src/utils/mappers.ts (4 hunks)
Files skipped from review due to trivial changes (2)
  • libs/api/domains/driving-license-book/src/lib/dto/student.input.ts
  • libs/application/templates/driving-instructor-registrations/src/types/enums.ts
Additional context used
Path-based instructions (16)
libs/api/domains/driving-license-book/src/index.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/types/src/lib/template-api/shared-api/shared-api-definitions/driving-license.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/driving-instructor-registrations/src/graphql/queries.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/driving-instructor-registrations/src/forms/instructorRegistrations.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/driving-instructor-registrations/src/lib/InstructorRegistrationsTemplate.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/driving-license-book/src/lib/drivingLicenceBook.type.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/driving-license-book/src/lib/utils/drivingLicenseBookMapper.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/driving-license-book/src/lib/drivingLicenseBookType.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/api/domains/driving-license-book/src/lib/drivingLicenseBook.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/clients/driving-license-book/src/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/api/domains/driving-license-book/src/lib/drivingLicenseBook.resolver.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/driving-instructor-registrations/src/fields/StudentsOverview/index.tsx (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/shared/api/driving-license/driving-license.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/driving-instructor-registrations/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."
libs/clients/driving-license-book/src/lib/drivingLicenseBookClient.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/driving-instructor-registrations/src/fields/ViewStudent/index.tsx (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 (34)
libs/api/domains/driving-license-book/src/index.ts (1)

4-4: Export of TeacherRights aligns with the new functionalities introduced.

libs/application/types/src/lib/template-api/shared-api/shared-api-definitions/driving-license.ts (1)

10-13: Definition of GetTeacherRightsApi is correctly implemented to support new teacher rights functionalities.

libs/application/templates/driving-instructor-registrations/src/graphql/queries.ts (1)

45-46: Updated GraphQL query correctly handles the licenseCategory parameter, aligning with the new functionality for B and BE licenses.

libs/application/templates/driving-instructor-registrations/src/forms/instructorRegistrations.ts (1)

44-48: Addition of GetTeacherRightsApi as a data provider item is correctly implemented to support fetching teacher rights.

libs/application/templates/driving-instructor-registrations/src/lib/InstructorRegistrationsTemplate.ts (2)

12-12: Import of GetTeacherRightsApi correctly added.


62-66: Integration of GetTeacherRightsApi in the API array is correctly implemented.

#!/bin/bash
# Description: Verify the integration of GetTeacherRightsApi across the application.

# Test: Search for the usage of GetTeacherRightsApi. Expect: Proper integration and no errors.
rg --type typescript $'GetTeacherRightsApi'

Also applies to: 73-73

libs/api/domains/driving-license-book/src/lib/drivingLicenceBook.type.ts (1)

119-123: Definition of TeacherRights interface is correctly implemented and aligns with the new functionality requirements.

libs/api/domains/driving-license-book/src/lib/utils/drivingLicenseBookMapper.ts (1)

33-38: Updated calculation for totalLessonTime using reduce function is correctly implemented and enhances data accuracy.

libs/clients/driving-license-book/src/lib/drivingLicenseBookType.types.ts (2)

71-71: Addition of optional licenseCategory property in DrivingLicenseBookStudentInput is correctly implemented and supports the new functionality.


171-175: Consistent implementation of TeacherRights interface across different files enhances maintainability.

libs/api/domains/driving-license-book/src/lib/drivingLicenseBook.service.ts (4)

19-19: Ensure TeacherRights is correctly imported and utilized.


88-94: Verify the correct handling of licenseCategory in getStudent.

#!/bin/bash
# Description: Verify that the `licenseCategory` parameter is correctly handled in the `getStudent` method.

# Test: Search for the method usage. Expect: Correct handling of the parameter.
rg --type typescript $'getStudent'

100-107: Ensure that the licenseCategory parameter is correctly propagated and utilized in getStudentsForTeacher.

#!/bin/bash
# Description: Verify that the `licenseCategory` parameter is correctly propagated in the `getStudentsForTeacher` method.

# Test: Search for the method usage. Expect: Correct propagation of the parameter.
rg --type typescript $'getStudentsForTeacher'

165-170: Confirm that getTeacher method correctly retrieves TeacherRights.

#!/bin/bash
# Description: Verify that the `getTeacher` method correctly retrieves `TeacherRights`.

# Test: Search for the method usage. Expect: Correct retrieval of `TeacherRights`.
rg --type typescript $'getTeacher'
libs/clients/driving-license-book/src/utils/mappers.ts (3)

8-8: Ensure TeacherDetailsGetResponse is correctly imported and utilized.


17-17: Ensure TeacherRights is correctly imported and utilized.


172-180: Verify the correct mapping of TeacherRights from TeacherDetailsGetResponse.

#!/bin/bash
# Description: Verify that the `teacherRightsMapper` function correctly maps `TeacherRights` from `TeacherDetailsGetResponse`.

# Test: Search for the function usage. Expect: Correct mapping of `TeacherRights`.
rg --type typescript $'teacherRightsMapper'
libs/api/domains/driving-license-book/src/lib/drivingLicenseBook.resolver.ts (1)

61-68: Ensure the licenseCategory parameter is correctly handled in the GraphQL resolver.

#!/bin/bash
# Description: Verify that the `licenseCategory` parameter is correctly handled in the GraphQL resolver.

# Test: Search for the resolver usage. Expect: Correct handling of the parameter.
rg --type typescript $'drivingLicenseBookStudentsForTeacher'
libs/application/templates/driving-instructor-registrations/src/fields/StudentsOverview/index.tsx (6)

10-10: Ensure Tabs component is correctly imported and utilized.


25-26: Ensure LicenseCategory enum is correctly imported and utilized.


36-44: Verify the correct handling of licenseCategory in the GraphQL query.

#!/bin/bash
# Description: Verify that the `licenseCategory` variable is correctly handled in the GraphQL query.

# Test: Search for the query usage. Expect: Correct handling of the variable.
rg --type typescript $'InstructorsStudentsQuery'

56-61: Confirm that teacherRights are correctly retrieved and utilized to conditionally display tabs.

#!/bin/bash
# Description: Verify that `teacherRights` are correctly retrieved and utilized in the component.

# Test: Search for the component usage. Expect: Correct retrieval and utilization of `teacherRights`.
rg --type typescript $'StudentsOverview'

96-122: Ensure the conditional rendering logic for tabs based on currentTab and teacherRights is correct.

#!/bin/bash
# Description: Verify that the conditional rendering logic for tabs based on `currentTab` and `teacherRights` is correct.

# Test: Search for the component usage. Expect: Correct conditional rendering logic.
rg --type typescript $'StudentsOverview'

240-240: Confirm that licenseCategory is correctly passed to the ViewStudent component.

#!/bin/bash
# Description: Verify that the `licenseCategory` is correctly passed to the `ViewStudent` component.

# Test: Search for the component usage. Expect: Correct passing of `licenseCategory`.
rg --type typescript $'ViewStudent'
libs/application/template-api-modules/src/lib/modules/shared/api/driving-license/driving-license.service.ts (1)

17-17: Ensure TeacherRights is utilized effectively in the service.

libs/application/templates/driving-instructor-registrations/src/lib/messages.ts (2)

130-139: Ensure new message definitions align with UI requirements.

The new message definitions for the B and BE license tabs are clear and consistent with existing message structures. Ensure they align with the UI requirements and are correctly utilized in the UI components.


147-151: Review the specificity of the new message for BE license.

The message for the BE license is specific and clearly differentiates from the general B license, which is good for user clarity.

libs/clients/driving-license-book/src/lib/drivingLicenseBookClient.service.ts (4)

32-32: Ensure TeacherRights is properly integrated into the service.


42-42: Review the integration of teacherRightsMapper.

The integration of teacherRightsMapper is appropriate and follows the existing pattern of utilizing mappers for data transformation in this service.


183-190: Review the handling of licenseCategory in getStudentsForTeacher.

The addition of licenseCategory to getStudentsForTeacher method is a significant enhancement that allows filtering students based on their license type. Ensure this parameter is properly handled in all related API calls.


423-430: Review the implementation of getTeacher.

The method getTeacher correctly utilizes the teacherRightsMapper to transform the API response into TeacherRights. This is consistent with the service's pattern of using mappers for data transformation.

libs/application/templates/driving-instructor-registrations/src/fields/ViewStudent/index.tsx (3)

54-54: Ensure consistent usage of the licenseCategory prop throughout the component.

The addition of licenseCategory to the destructured props in the function signature is correctly implemented and used consistently in the GraphQL query.


70-70: Review the fetch policy setting in the GraphQL query.

Setting the fetchPolicy to 'no-cache' ensures that the most current data is fetched each time, which is appropriate for dynamic student data that might change frequently.


67-67: Validate the licenseCategory prop to ensure it matches expected values.

#!/bin/bash
# Description: Verify that the `licenseCategory` prop is always passed as 'B' or 'BE' throughout the application.

# Test: Search for incorrect usages of the `licenseCategory` prop. Expect: No occurrences of incorrect values.
rg --type typescript --glob '*.{ts,tsx}' 'licenseCategory: [^'\'']B'\'']'

Ensure that the licenseCategory prop is always either 'B' or 'BE'. This validation is crucial to prevent runtime errors and ensure data integrity.

@juni-haukur juni-haukur added the automerge Merge this PR as soon as all checks pass label Jun 10, 2024
@juni-haukur juni-haukur removed the deploy-feature Deploys features to dev label Jun 10, 2024
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 (2)
libs/application/templates/driving-instructor-registrations/src/fields/StudentsOverview/index.tsx (2)

Line range hint 166-169: Use self-closing tags for JSX elements without children to improve readability and adhere to best practices.

-                <T.HeadData style={styles.tableStyles}></T.HeadData>
+                <T.HeadData style={styles.tableStyles} />

Line range hint 176-176: Use optional chaining to safely access properties on potentially undefined objects.

-          student.totalLessonCount.toFixed(2) ?? 0
+          student.totalLessonCount?.toFixed(2) ?? 0

This change ensures that the code does not throw an error if totalLessonCount is undefined.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ed2a464 and 99181eb.

Files selected for processing (4)
  • libs/application/templates/driving-instructor-registrations/src/fields/StudentsOverview/index.tsx (5 hunks)
  • libs/application/templates/driving-instructor-registrations/src/forms/instructorRegistrations.ts (3 hunks)
  • libs/application/templates/driving-instructor-registrations/src/lib/InstructorRegistrationsTemplate.ts (2 hunks)
  • libs/application/templates/driving-instructor-registrations/src/lib/getApplicationFeatureFlags.ts (1 hunks)
Additional context used
Path-based instructions (4)
libs/application/templates/driving-instructor-registrations/src/lib/getApplicationFeatureFlags.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/driving-instructor-registrations/src/forms/instructorRegistrations.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/driving-instructor-registrations/src/lib/InstructorRegistrationsTemplate.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/driving-instructor-registrations/src/fields/StudentsOverview/index.tsx (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/templates/driving-instructor-registrations/src/lib/getApplicationFeatureFlags.ts

[error] 26-26: Avoid the use of spread (...) syntax on accumulators. (lint/performance/noAccumulatingSpread)

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

libs/application/templates/driving-instructor-registrations/src/fields/StudentsOverview/index.tsx

[error] 166-169: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing. (lint/style/useSelfClosingElements)

Unsafe fix: Use a SelfClosingElement instead


[error] 176-176: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.

Additional comments not posted (3)
libs/application/templates/driving-instructor-registrations/src/forms/instructorRegistrations.ts (2)

44-48: Ensure that the new data provider GetTeacherRightsApi is correctly integrated and utilized in the form.


64-65: Confirm that the allowBELicense feature flag is effectively used to conditionally render form fields.

libs/application/templates/driving-instructor-registrations/src/lib/InstructorRegistrationsTemplate.ts (1)

56-67: Confirm that the feature flags are correctly used to conditionally load the form configuration based on the ALLOW_BE_LICENSE flag.

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

Outside diff range and nitpick comments (3)
libs/application/templates/driving-instructor-registrations/src/fields/StudentsOverview/index.tsx (3)

Line range hint 166-169: Use self-closing tags for empty JSX elements.

In JSX, elements without children should be self-closing to improve readability and conform to style guidelines.

-              <Tabs
-                selected={currentTab}
-                onlyRenderSelectedTab={true}
-                label={''}
+              <Tabs
+                selected={currentTab}
+                onlyRenderSelectedTab={true}
+                label={''} />

Line range hint 176-176: Utilize optional chaining for safer property access.

Using optional chaining can prevent runtime errors when accessing properties on objects that might be undefined or null.

-          student.totalLessonCount.toFixed(2) ?? 0
+          student.totalLessonCount?.toFixed(2) ?? 0

244-244: Ensure consistency in prop passing.

It's good practice to maintain consistency in how props are passed to components. Here, licenseCategory is passed explicitly, but other props related to the student could be structured similarly for clarity.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ed2a464 and 2a2ce05.

Files selected for processing (5)
  • libs/application/templates/driving-instructor-registrations/src/fields/StudentsOverview/index.tsx (5 hunks)
  • libs/application/templates/driving-instructor-registrations/src/forms/instructorRegistrations.ts (3 hunks)
  • libs/application/templates/driving-instructor-registrations/src/lib/InstructorRegistrationsTemplate.ts (2 hunks)
  • libs/application/templates/driving-instructor-registrations/src/lib/getApplicationFeatureFlags.ts (1 hunks)
  • libs/clients/driving-license-book/src/lib/drivingLicenseBookType.types.ts (2 hunks)
Additional context used
Path-based instructions (5)
libs/application/templates/driving-instructor-registrations/src/lib/getApplicationFeatureFlags.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/driving-instructor-registrations/src/forms/instructorRegistrations.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/driving-instructor-registrations/src/lib/InstructorRegistrationsTemplate.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/driving-license-book/src/lib/drivingLicenseBookType.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/driving-instructor-registrations/src/fields/StudentsOverview/index.tsx (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/templates/driving-instructor-registrations/src/lib/getApplicationFeatureFlags.ts

[error] 26-26: Avoid the use of spread (...) syntax on accumulators. (lint/performance/noAccumulatingSpread)

Spread syntax should be avoided on accumulators (like those in .reduce) because it causes a time complexity of O(n^2).
Consider methods such as .splice or .push instead.

libs/application/templates/driving-instructor-registrations/src/fields/StudentsOverview/index.tsx

[error] 166-169: JSX elements without children should be marked as self-closing. In JSX, it is valid for any element to be self-closing. (lint/style/useSelfClosingElements)

Unsafe fix: Use a SelfClosingElement instead


[error] 176-176: Change to an optional chain. (lint/complexity/useOptionalChain)

Unsafe fix: Change to an optional chain.

Additional comments not posted (3)
libs/application/templates/driving-instructor-registrations/src/forms/instructorRegistrations.ts (1)

64-66: Validate the allowBELicense flag usage.

Ensure that the allowBELicense flag is being correctly passed and utilized in all relevant components and queries. This is crucial for feature flag management and to avoid unexpected behavior.

libs/application/templates/driving-instructor-registrations/src/lib/InstructorRegistrationsTemplate.ts (1)

56-67: Ensure dynamic form loading based on feature flags.

The implementation dynamically loads the form configuration based on the ALLOW_BE_LICENSE feature flag. This is a good practice for feature toggling and ensures that the application can adapt to configuration changes without redeployment.

libs/clients/driving-license-book/src/lib/drivingLicenseBookType.types.ts (1)

171-175: Add new TeacherRights interface.

The addition of the TeacherRights interface aligns with the new functionalities introduced in the PR, such as handling different types of driving lessons and rights management for instructors.

@kodiakhq kodiakhq bot merged commit 7d04418 into main Jun 11, 2024
82 checks passed
@kodiakhq kodiakhq bot deleted the feat/trailer-license-instructor branch June 11, 2024 09:16
kodiakhq bot added a commit that referenced this pull request Jun 11, 2024
* fix(inheritance-report): EFS touch ups (#15161)

* fix(inheritance-report): EFS touch ups

* done texts

* tweaks

* texts

* removed unused files

---------

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

* feat(license-service): less contentful (#15088)

* feat: less contentful

* chore:use reaodnly

* chore: remove unnecessary

* chore: console logs

---------

Co-authored-by: Þorkell Máni Þorkelsson <mani@hugsmidjan.is>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>

* chore(user-profile): Remove migration worker and make user profile strict (#14791)

* Remove worker and make user profile strict

* Fix dependant type errors.

---------

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

* feat(j-s): Actor title in indictment confirmation pt2 (#15149)

* Convert px to pts

* Use Pts instead of pxls

* Refactoring

* Revert change

* Tweeks to COA

* Tweeks to COA

* Smaller COA

* Cleanup

* Make title optional

* Don't use Beygla for confirmation

* Move confirmation stamp from pxls to pts

* Remove debug code

* Fix lint

---------

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

* feat(driving-instructor-registrations): Add tabs for B and BE license (#14609)

* add tabs for B and BE license

* set no-cache on query

* fetch license category specific book

* only display tabs for teachers with multiple rights

* add feature flag

* remove console logs

* address comments

---------

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

* fix: formstepper formatMessage

* chore: simplify slightly

* fix(ojoi): Datepicker default date (#15177)

---------

Co-authored-by: albinagu <47886428+albinagu@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Co-authored-by: Þorkell Máni Þorkelsson <wowthorkell@gmail.com>
Co-authored-by: Þorkell Máni Þorkelsson <mani@hugsmidjan.is>
Co-authored-by: Sævar Már Atlason <54210288+saevarma@users.noreply.github.com>
Co-authored-by: Ívar Oddsson <ivaroddsson@gmail.com>
Co-authored-by: juni-haukur <158475136+juni-haukur@users.noreply.github.com>
Co-authored-by: Þórður H <thordur@hugsmidjan.is>
sigruntg pushed a commit that referenced this pull request Jun 12, 2024
…#14609)

* add tabs for B and BE license

* set no-cache on query

* fetch license category specific book

* only display tabs for teachers with multiple rights

* add feature flag

* remove console logs

* address comments

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
lodmfjord pushed a commit that referenced this pull request Jun 14, 2024
…#14609)

* add tabs for B and BE license

* set no-cache on query

* fetch license category specific book

* only display tabs for teachers with multiple rights

* add feature flag

* remove console logs

* address comments

---------

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

Successfully merging this pull request may close these issues.

4 participants