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 Name #16729

Merged
merged 3 commits into from
Nov 5, 2024
Merged

fix(j-s): Indictment Name #16729

merged 3 commits into from
Nov 5, 2024

Conversation

gudjong
Copy link
Member

@gudjong gudjong commented Nov 5, 2024

Indictment Name

Nafn á ákæru í Auði

What

  • Fixes indictment name sent to court.

Why

  • Verified bug.

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 court upload messages with dynamic placeholders for court case numbers and dates.
    • Improved filename generation for indictment documents to include court case numbers for better context.
  • Bug Fixes

    • Updated message identifiers to ensure consistency and clarity in the messaging system.

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@gudjong gudjong requested a review from a team as a code owner November 5, 2024 17:03
Copy link
Contributor

coderabbitai bot commented Nov 5, 2024

Walkthrough

The changes in this pull request involve updates to message definitions in the courtUpload.ts file, enhancing the context of messages related to court uploads by introducing dynamic placeholders for courtCaseNumber and date. Additionally, the InternalCaseService class has been modified to improve the filename generation for indictment documents by incorporating the courtCaseNumber. These changes aim to provide clearer context and specificity for uploaded documents.

Changes

File Path Change Summary
apps/judicial-system/backend/src/app/messages/courtUpload.ts Updated message IDs and defaultMessage values for indictment, courtRecord, and ruling to include placeholders for courtCaseNumber and date.
apps/judicial-system/backend/src/app/modules/case/internalCase.service.ts Modified the deliverIndictmentToCourt method to enhance fileName generation by incorporating courtCaseNumber from the theCase object.
apps/judicial-system/backend/src/app/modules/case/test/internalCaseController/deliverIndictmentToCourt.spec.ts Updated test cases to reflect changes in document naming conventions, incorporating courtCaseNumber into the names passed to the createDocument method.

Possibly related PRs

Suggested reviewers

  • unakb

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

🧹 Outside diff range and nitpick comments (1)
apps/judicial-system/backend/src/app/messages/courtUpload.ts (1)

Line range hint 1-30: Consider standardizing version numbering across messages.

I notice inconsistent version suffixes in the message IDs:

  • indictment uses _v2
  • ruling uses _v3
  • Some messages have no version suffix

Consider adopting a consistent versioning strategy across all messages to make maintenance easier.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f9931f3 and b9cbcef.

📒 Files selected for processing (2)
  • apps/judicial-system/backend/src/app/messages/courtUpload.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/case/internalCase.service.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
apps/judicial-system/backend/src/app/messages/courtUpload.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/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 (2)
apps/judicial-system/backend/src/app/messages/courtUpload.ts (1)

10-11: LGTM! Verify placeholder usage across consumers.

The addition of the courtCaseNumber placeholder in the indictment message aligns with the PR objective to fix the indictment naming issue.

Let's verify that all consumers properly handle the new placeholder:

✅ Verification successful

Placeholder usage verified and correctly implemented

The courtCaseNumber placeholder is properly handled in the only consumer of this message (internalCase.service.ts). The service correctly passes the required parameter when formatting the message:

formatMessage(courtUpload.indictment, {
  courtCaseNumber: theCase.courtCaseNumber,
})
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all usages of the indictment message to ensure they provide the courtCaseNumber parameter

# Search for direct references to courtUpload.indictment
rg -l "courtUpload\.indictment" 

# Search for formatMessage calls that might use this ID
ast-grep --pattern 'formatMessage($args)' 

Length of output: 151


Script:

#!/bin/bash
# Let's examine the actual usage in internalCase.service.ts
rg -A 5 -B 5 "courtUpload\.indictment" apps/judicial-system/backend/src/app/modules/case/internalCase.service.ts

# Also check for any formatMessage calls in this file
ast-grep --pattern 'formatMessage({ id: $_, $$ })' apps/judicial-system/backend/src/app/modules/case/internalCase.service.ts

Length of output: 572

apps/judicial-system/backend/src/app/modules/case/internalCase.service.ts (1)

546-548: LGTM! The filename enhancement improves document identification.

Including the courtCaseNumber in the indictment filename makes it easier to identify and track documents in the court system.

Let's verify the message format string:

Copy link

codecov bot commented Nov 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.53%. Comparing base (e8487ac) to head (6d1aeee).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #16729   +/-   ##
=======================================
  Coverage   36.53%   36.53%           
=======================================
  Files        6890     6890           
  Lines      143640   143640           
  Branches    40926    40926           
=======================================
  Hits        52486    52486           
  Misses      91154    91154           
Flag Coverage Δ
judicial-system-backend 55.17% <100.00%> (ø)

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

Files with missing lines Coverage Δ
...ial-system/backend/src/app/messages/courtUpload.ts 100.00% <ø> (ø)
...ckend/src/app/modules/case/internalCase.service.ts 85.12% <100.00%> (ø)

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 e8487ac...6d1aeee. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Nov 5, 2024

Datadog Report

All test runs 01a80d6 🔗

18 Total Test Services: 1 Failed, 16 Passed
🔻 Test Sessions change in coverage: 2 decreased, 39 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
judicial-system-backend 2 0 0 21229 0 20m 4.84s 1 no change Link
api 0 0 0 4 0 2.88s 1 no change Link
api-domains-auth-admin 0 0 0 18 0 12.97s 1 no change Link
api-domains-communications 0 0 0 5 0 31.26s 1 no change Link
api-domains-license-service 0 0 0 0 0 667.64ms 1 no change Link
application-system-api 0 0 0 120 2 3m 15.61s 1 no change Link
application-template-api-modules 0 0 0 123 0 2m 43.62s 1 no change Link
auth-api-lib 0 0 0 20 0 32.83s 1 no change Link
cms-translations 0 0 0 3 0 29.5s 1 no change Link
judicial-system-api 0 0 0 59 0 6.41s 1 no change Link

❌ Failed Tests (2)

  • InternalCaseController - Deliver indictment to court deliver generated indictment pdf to court should deliver the indictment - apps/judicial-system/backend/src/app/modules/case/test/internalCaseController/deliverIndictmentToCourt.spec.ts - Details

    Expand for error
     expect(jest.fn()).toHaveBeenCalledWith(...expected)
     
     - Expected
     + Received
     
       {"id": "9d7330a1-4756-499e-92fb-59657f35d073"},
       "c3c1d33f-beb3-4ee2-978f-805f6d173b2e",
       "b5bf5b10-3a00-44fe-a916-e2c882869842",
       "012b9e83-2ba3-4d16-a486-120d139b1e8a",
       "Ákæra og greinargerð",
     ...
    
  • InternalCaseController - Deliver indictment to court deliver indictment pdf from AWS S3 to court should use the AWS S3 pdf - apps/judicial-system/backend/src/app/modules/case/test/internalCaseController/deliverIndictmentToCourt.spec.ts - Details

    Expand for error
     expect(jest.fn()).toHaveBeenCalledWith(...expected)
     
     - Expected
     + Received
     
       {"id": "9d7330a1-4756-499e-92fb-59657f35d073"},
       "c3c1d33f-beb3-4ee2-978f-805f6d173b2e",
       "b5bf5b10-3a00-44fe-a916-e2c882869842",
       "012b9e83-2ba3-4d16-a486-120d139b1e8a",
       "Ákæra og greinargerð",
     ...
    

🔻 Code Coverage Decreases vs Default Branch (2)

  • services-auth-delegation-api - jest 51.72% (-0.19%) - Details
  • services-auth-personal-representative-public - jest 41.01% (-0.04%) - Details

@oddsson oddsson added the automerge Merge this PR as soon as all checks pass label Nov 5, 2024
gudjong and others added 2 commits November 5, 2024 22:06
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

🧹 Outside diff range and nitpick comments (2)
apps/judicial-system/backend/src/app/modules/case/test/internalCaseController/deliverIndictmentToCourt.spec.ts (2)

106-107: LGTM! Consider extracting the duplicated string literal.

The changes correctly implement the dynamic indictment naming with courtCaseNumber. However, the string literal 'Ákæra' is duplicated across test cases.

Consider extracting it to a constant at the top of the file:

+ const INDICTMENT_BASE_NAME = 'Ákæra'

Then update the test cases:

- `Ákæra ${courtCaseNumber}`,
- `Ákæra ${courtCaseNumber}.pdf`,
+ `${INDICTMENT_BASE_NAME} ${courtCaseNumber}`,
+ `${INDICTMENT_BASE_NAME} ${courtCaseNumber}.pdf`,

Also applies to: 131-132


106-107: Add explicit assertion for courtCaseNumber inclusion.

While the test verifies the complete filename, it would be more robust to explicitly assert that the courtCaseNumber is included in the document name.

Add these assertions after the existing expect calls:

expect(mockCourtService.createDocument.mock.calls[0][5]).toContain(courtCaseNumber)
expect(mockCourtService.createDocument.mock.calls[0][6]).toContain(courtCaseNumber)
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b9cbcef and 6d1aeee.

📒 Files selected for processing (1)
  • apps/judicial-system/backend/src/app/modules/case/test/internalCaseController/deliverIndictmentToCourt.spec.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
apps/judicial-system/backend/src/app/modules/case/test/internalCaseController/deliverIndictmentToCourt.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."

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.

None yet

2 participants