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

chore(j-s): Completed case notifications #14832

Merged
merged 5 commits into from
May 21, 2024

Conversation

oddsson
Copy link
Member

@oddsson oddsson commented May 16, 2024

Completed case notifications

Asana

What

Update text in notifications sent to prosecutors and defenders when an indictment is completed.

Why

We are adding the decision made by the judge in the email and making it a little more readable for the recipient.

Screenshots / Gifs

Screenshot 2024-05-16 at 13 17 17

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

    • Enhanced notification messages for case completion, providing clearer and more detailed information for prosecutors and defenders.
  • Improvements

    • Updated subject line for case completion notifications to be more descriptive.
    • Revised body content of case completion notifications to include case outcome details and access instructions for related documents.
  • Backend Enhancements

    • Introduced a function to convert case indictment ruling decisions into human-readable strings for better clarity in notifications.

@oddsson oddsson requested a review from a team as a code owner May 16, 2024 13:20
Copy link
Contributor

coderabbitai bot commented May 16, 2024

Warning

Rate Limit Exceeded

@oddsson has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 52 minutes and 56 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between 687f7f0 and 45e090f.

Walkthrough

The recent updates to the judicial system's backend notifications involve refining the case_completed notification messages. Changes include updating message content for both prosecutors and defenders, introducing clearer information and details. Furthermore, a new function in the formatters library enhances notification clarity by converting CaseIndictmentRulingDecision enum values into human-readable strings.

Changes

File Change Summary
.../notifications.ts Updated subject, prosecutorBody, and defenderBody messages for case_completed notifications. Altered IDs and default messages accordingly.
.../notification.service.ts Integrated getHumanReadableCaseIndictmentRulingDecision function to format indictmentRulingDecision in caseCompleted method for notifications.
.../formatters.ts Added getHumanReadableCaseIndictmentRulingDecision function to convert CaseIndictmentRulingDecision enum values to human-readable strings and updated exports.

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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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: 1

Review Details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0406cc2 and 1b2645a.
Files selected for processing (3)
  • apps/judicial-system/backend/src/app/messages/notifications.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/notification/notification.service.ts (3 hunks)
  • libs/judicial-system/formatters/src/lib/formatters.ts (2 hunks)
Additional Context Used
Path-based Instructions (3)
libs/judicial-system/formatters/src/lib/formatters.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."
apps/judicial-system/backend/src/app/messages/notifications.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."
apps/judicial-system/backend/src/app/modules/notification/notification.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 (6)
apps/judicial-system/backend/src/app/messages/notifications.ts (3)

300-301: The updated case_completed.subject message ID and default message are appropriate and align with the PR objectives.


306-308: The updated case_completed.prosecutor_body message includes additional details such as the case decision and a link to the case overview page, which improves clarity and informativeness.


313-315: The updated case_completed.defender_body message includes additional details such as the case decision and conditional access information, which improves clarity and informativeness.

apps/judicial-system/backend/src/app/modules/notification/notification.service.ts (3)

30-30: Import statement for getHumanReadableCaseIndictmentRulingDecision looks good.


967-970: Usage of getHumanReadableCaseIndictmentRulingDecision is correctly integrated into the notification body.


1005-1008: Usage of getHumanReadableCaseIndictmentRulingDecision is correctly integrated into the notification body.

libs/judicial-system/formatters/src/lib/formatters.ts Outdated Show resolved Hide resolved
Copy link

codecov bot commented May 16, 2024

Codecov Report

Attention: Patch coverage is 11.11111% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 36.97%. Comparing base (9a95a96) to head (45e090f).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #14832      +/-   ##
==========================================
- Coverage   36.98%   36.97%   -0.01%     
==========================================
  Files        6327     6327              
  Lines      129006   129015       +9     
  Branches    36817    36820       +3     
==========================================
+ Hits        47707    47708       +1     
- Misses      81299    81307       +8     
Flag Coverage Δ
api 3.48% <ø> (ø)
application-template-api-modules 24.37% <ø> (-0.02%) ⬇️
application-templates-financial-aid 12.10% <ø> (ø)
application-ui-shell 21.72% <ø> (ø)
financial-aid-backend 56.44% <ø> (ø)
financial-aid-shared 17.34% <ø> (ø)
judicial-system-api 17.63% <ø> (ø)
judicial-system-formatters 82.08% <11.11%> (-0.86%) ⬇️
judicial-system-web 28.07% <11.11%> (-0.02%) ⬇️
services-auth-personal-representative 49.75% <ø> (ø)

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

Files Coverage Δ
...l-system/backend/src/app/messages/notifications.ts 100.00% <ø> (ø)
...c/app/modules/notification/notification.service.ts 78.37% <ø> (ø)
...s/judicial-system/formatters/src/lib/formatters.ts 80.34% <11.11%> (-3.80%) ⬇️

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 9a95a96...45e090f. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

All test runs ba471b2 🔗

5 Total Test Services: 1 Failed, 4 Passed
🔻 Test Sessions change in coverage: 3 decreased, 2 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
judicial-system-backend 1 0 0 19414 0 17m 4.14s 1 no change Link
judicial-system-api 0 0 0 54 0 14.39s 1 no change Link
judicial-system-formatters 0 0 0 36 0 17.65s 1 decreased (-0.53%) Link
judicial-system-web 0 0 0 312 0 1m 18.72s 1 decreased (-0.01%) Link
judicial-system-xrd-api 0 0 0 6 0 9.72s 1 decreased (-0.26%) Link

❌ Failed Tests (1)

  • InternalNotificationController - Send ruling notifications email to prosecutor for indictment case should send email to prosecutor - apps/judicial-system/backend/src/app/modules/notification/test/internalNotificationController/sendRulingNotifications.spec.ts - Details

    Expand for error
     expect(jest.fn()).toHaveBeenCalledWith(...expected)
     
     Expected: ObjectContaining {"html": "Dómari hefur staðfest dóm í máli 007-2022-07 hjá Héraðsdómi Reykjavíkur.<br /><br />Skjöl málsins eru aðengileg á <a href=\"http://localhost:4200/akaera/yfirlit/ab4cb195-dafc-4770-ab17-fc5422b3ddb1\">yfirlitssíðu málsins í Réttarvörslugátt</a>.", "subject": "Dómur í máli 007-2022-07", "to": [{"address": "[email protected]", "name": "Lögmaður"}]}
     Received: {"attachments": undefined, "cc": undefined, "from": {"address": "[email protected]", "name": "Réttarvörslugátt"}, "html": "Máli 007-2022-07 hjá Héraðsdómi Reykjavíkur hefur verið lokið.<br /><br />Niðurstaða: <br /><br />Skjöl málsins eru aðengileg á <a href=\"http://localhost:4200/akaera/yfirlit/ab4cb195-dafc-4770-ab17-fc5422b3ddb1\">yfirlitssíðu málsins í Réttarvörslugátt</a>.", "replyTo": {"address": "[email protected]", "name": "Réttarvörslugátt"}, "subject": "Máli lokið 007-2022-07", "text": "Máli 007-2022-07 hjá Héraðsdómi Reykjavíkur hefur verið lokið.·
     Niðurstaða:··
     Skjöl málsins eru aðengileg á yfirlitssíðu málsins í Réttarvörslugátt.", "to": [{"address": "[email protected]", "name": "Lögmaður"}]}
     
     Number of calls: 1
    

🔻 Code Coverage Decreases vs Default Branch (3)

  • judicial-system-formatters - jest 89.53% (-0.53%) - Details
  • judicial-system-xrd-api - jest 74.55% (-0.26%) - Details
  • judicial-system-web - jest 32.41% (-0.01%) - Details

Copy link
Member

@gudjong gudjong left a comment

Choose a reason for hiding this comment

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

I agree with the reabbit's comment.

@oddsson oddsson added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label May 21, 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 1b2645a and 687f7f0.
Files selected for processing (3)
  • apps/judicial-system/backend/src/app/messages/notifications.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/notification/notification.service.ts (3 hunks)
  • libs/judicial-system/formatters/src/lib/formatters.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • apps/judicial-system/backend/src/app/modules/notification/notification.service.ts
Files skipped from review as they are similar to previous changes (2)
  • apps/judicial-system/backend/src/app/messages/notifications.ts
  • libs/judicial-system/formatters/src/lib/formatters.ts

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