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(j-s): Indictment assigned roles in robot message #15434

Merged
merged 5 commits into from
Jul 10, 2024

Conversation

unakb
Copy link
Member

@unakb unakb commented Jul 3, 2024

Senda aðstoðarmann dómara á robot ef úthlutað er á hann

What

Send the correct role for a district court assistant to the court robot

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

  • Bug Fixes

    • Corrected role assignment logic in case handling to dynamically assign roles based on judge and registrar entities.
  • Tests

    • Updated test cases to include dynamic role assignments for judges.

@unakb unakb requested a review from a team as a code owner July 3, 2024 14:21
Copy link
Contributor

coderabbitai bot commented Jul 3, 2024

Walkthrough

The recent changes modify how roles are assigned to judge and registrar entities within the InternalCaseService class. Instead of using fixed roles like DISTRICT_COURT_JUDGE and DISTRICT_COURT_REGISTRAR, the roles are now dynamically set based on the roles of the respective entities. This change ensures the system uses the actual roles of the judge and registrar in case handling, adding flexibility and accuracy in role assignments.

Changes

File Path Change Summary
.../internalCase.service.ts Updated logic for role assignment to dynamically use roles from the judge and registrar entities instead of fixed roles.
.../internalCaseController/deliverIndictmentAssignedRolesToCourt.spec.ts Introduced a role field to the judge object in the test case setup to reflect the dynamic role assignment changes in the service class.

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ee2100d and 4930867.

Files selected for processing (1)
  • apps/judicial-system/backend/src/app/modules/case/internalCase.service.ts (1 hunks)
Additional context used
Path-based instructions (1)
apps/judicial-system/backend/src/app/modules/case/internalCase.service.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
Additional comments not posted (2)
apps/judicial-system/backend/src/app/modules/case/internalCase.service.ts (2)

661-662: Ensure the role is always defined.

The dynamic assignment of the role is a good improvement. However, ensure that theCase.registrar?.role is always defined to avoid potential undefined values.


656-657: Ensure the role is always defined.

The dynamic assignment of the role is a good improvement. However, ensure that theCase.judge?.role is always defined to avoid potential undefined values.

@datadog-island-is
Copy link

datadog-island-is bot commented Jul 3, 2024

Datadog Report

All test runs 871e60f 🔗

68 Total Test Services: 0 Failed, 67 Passed
🔻 Test Sessions change in coverage: 2 decreased, 1 increased (+0.02%), 197 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 2.84s N/A Link
api-catalogue-services 0 0 0 23 0 11.87s N/A Link
api-domains-communications 0 0 0 5 0 33.91s N/A Link
api-domains-criminal-record 0 0 0 5 0 9.92s 1 no change Link
api-domains-driving-license 0 0 0 23 0 32.95s N/A Link
api-domains-education 0 0 0 8 0 21.23s N/A Link
api-domains-health-insurance 0 0 0 4 0 16.2s 1 no change Link
api-domains-payment-schedule 0 0 0 6 0 16.21s N/A Link
application-system-api 0 0 0 111 2 3m 19.71s 1 no change Link
application-template-api-modules 0 0 0 109 0 1m 53.22s 1 increased (+0.02%) Link

🔻 Code Coverage Decreases vs Default Branch (2)

  • license-api - jest 34.15% (-0.02%) - Details
  • auth-api-lib - jest 16.29% (-0.02%) - Details

@gudjong
Copy link
Member

gudjong commented Jul 10, 2024

Please fix tests

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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4930867 and 8d4168b.

Files selected for processing (1)
  • apps/judicial-system/backend/src/app/modules/case/test/internalCaseController/deliverIndictmentAssignedRolesToCourt.spec.ts (1 hunks)
Additional context used
Path-based instructions (1)
apps/judicial-system/backend/src/app/modules/case/test/internalCaseController/deliverIndictmentAssignedRolesToCourt.spec.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
Learnings (1)
apps/judicial-system/backend/src/app/modules/case/test/internalCaseController/deliverIndictmentAssignedRolesToCourt.spec.ts (1)
Learnt from: gudjong
PR: island-is/island.is#15241
File: apps/judicial-system/backend/src/app/modules/case/test/internalCaseController/deliverSignedRulingToPolice.spec.ts:41-42
Timestamp: 2024-06-14T15:09:49.085Z
Learning: User gudjong prefers not to make changes to error handling messages in test setups at this time.
Additional comments not posted (1)
apps/judicial-system/backend/src/app/modules/case/test/internalCaseController/deliverIndictmentAssignedRolesToCourt.spec.ts (1)

33-37: Change approved: Added role to judge object.

The role UserRole.DISTRICT_COURT_JUDGE has been correctly added to the judge object within the case setup.

@unakb unakb added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Jul 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: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8d4168b and 723274c.

Files selected for processing (1)
  • apps/judicial-system/backend/src/app/modules/case/internalCase.service.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/judicial-system/backend/src/app/modules/case/internalCase.service.ts

Copy link

codecov bot commented Jul 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 37.04%. Comparing base (13a3def) to head (4bad0c0).
Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15434      +/-   ##
==========================================
+ Coverage   37.02%   37.04%   +0.02%     
==========================================
  Files        6557     6557              
  Lines      134054   134065      +11     
  Branches    38378    38380       +2     
==========================================
+ Hits        49637    49670      +33     
+ Misses      84417    84395      -22     
Flag Coverage Δ
api 3.44% <ø> (ø)
api-catalogue-services 77.85% <ø> (ø)
api-domains-communications 40.56% <ø> (ø)
api-domains-criminal-record 48.00% <ø> (ø)
api-domains-driving-license 44.39% <ø> (ø)
api-domains-education 33.71% <ø> (ø)
api-domains-health-insurance 34.88% <ø> (+0.04%) ⬆️
api-domains-payment-schedule 41.08% <ø> (+0.02%) ⬆️
application-system-api 41.83% <ø> (ø)
application-template-api-modules 23.95% <ø> (+0.03%) ⬆️
application-templates-parental-leave 28.44% <ø> (ø)
auth-admin-web 2.43% <ø> (ø)
auth-api-lib 14.67% <ø> (-0.05%) ⬇️
auth-react 23.02% <ø> (-0.06%) ⬇️
auth-shared 75.00% <ø> (ø)
clients-charge-fjs-v2 27.54% <ø> (ø)
clients-financial-statements-inao 49.21% <ø> (ø)
clients-middlewares 73.03% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.82% <ø> (+0.53%) ⬆️
content-search-index-manager 95.65% <ø> (ø)
contentful-apps 6.05% <ø> (ø)
dokobit-signing 62.31% <ø> (+0.09%) ⬆️
download-service 44.76% <ø> (ø)
feature-flags 90.24% <ø> (+0.07%) ⬆️
icelandic-names-registry-backend 54.18% <ø> (ø)
island-ui-core 28.85% <ø> (-0.07%) ⬇️
judicial-system-message 66.33% <ø> (ø)
judicial-system-message-handler 66.13% <ø> (ø)
judicial-system-scheduler 58.15% <ø> (ø)
judicial-system-types 50.35% <ø> (ø)
judicial-system-web 28.37% <ø> (ø)
localization 10.15% <ø> (ø)
logging 48.43% <ø> (ø)
message-queue 67.65% <ø> (ø)
portals-core 16.29% <ø> (-0.04%) ⬇️
reference-backend 50.31% <ø> (ø)
services-auth-admin-api 51.08% <ø> (ø)
services-auth-delegation-api 61.56% <ø> (ø)
services-auth-ids-api 54.62% <ø> (+0.01%) ⬆️
services-auth-personal-representative-public 44.13% <ø> (+0.01%) ⬆️
services-auth-public-api 51.04% <ø> (ø)
services-documents 60.96% <ø> (ø)
shared-form-fields 31.83% <ø> (ø)
shared-mocking 64.62% <ø> (ø)
shared-problem 87.50% <ø> (ø)
shared-utils 29.87% <ø> (ø)
skilavottord-ws 23.58% <ø> (ø)

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

Files Coverage Δ
...ckend/src/app/modules/case/internalCase.service.ts 85.40% <ø> (ø)

... and 5 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 c7dd9f8...4bad0c0. Read the comment docs.

@unakb unakb removed the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Jul 10, 2024
@gudjong gudjong added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Jul 10, 2024
@kodiakhq kodiakhq bot merged commit 9e17253 into main Jul 10, 2024
34 checks passed
@kodiakhq kodiakhq bot deleted the j-s/robot-assigned-court branch July 10, 2024 18:29
oskarjs pushed a commit that referenced this pull request Aug 20, 2024
* Update internalCase.service.ts

* Update deliverIndictmentAssignedRolesToCourt.spec.ts

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Oct 8, 2024
6 tasks
@coderabbitai coderabbitai bot mentioned this pull request Dec 2, 2024
6 tasks
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.

2 participants