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(j-s): Indictment overview for prison users #15357

Merged
merged 35 commits into from
Jul 8, 2024
Merged

Conversation

oddsson
Copy link
Member

@oddsson oddsson commented Jun 26, 2024

Indictment overview for prison users

Asana

What

This PR implements an indictment overview screen for prison users. It also changes the routing for prison users. Now their pages are prefixed with /fangelsi/, i.e. /fangelsi/krofur and /fangelsi/akaera/yfirlit/[id]

Why

When S-cases go live, the prisons need to be able to see the cases.

Screenshots / Gifs

Screenshot 2024-07-04 at 21 19 12

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • [ x 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 new routes and components for prison system users, including detailed indictment information and verdict overview.
    • Added new fields in the limitedAccessCase GraphQL query to capture indictment and event log details.
  • Bug Fixes

    • Updated component InfoCardClosedIndictment to correctly display indictment review information.
  • Improvements

    • Enhanced role-based routing across the application to differentiate between general and prison system users.
    • Updated various components to include new props for better handling of indictment and verdict display details.

Copy link
Contributor

coderabbitai bot commented Jun 26, 2024

Walkthrough

The updates focus on integrating new functionalities and enhancing existing features across various modules in the judicial system web and backend applications. This includes adding role-based routing, enhancing the CaseService with new event log capabilities, modifying several React components to handle indictment-related information, and introducing new GraphQL fields for better data handling. Additionally, it involves updates to string resources, route constants, and event types to support the new features.

Changes

Files/Paths Change Summaries
apps/judicial-system/api/src/.../auth/auth.controller.ts Added a new check for isPrisonSystemUser(user) to determine the route based on the user's role, including PRISON_CASES_ROUTE as an option.
apps/judicial-system/backend/src/.../case/case.service.ts Added condition handling for update.indictmentReviewDecision to create an event log of type INDICTMENT_REVIEWED.
apps/judicial-system/backend/src/.../case/limitedAccessCase.service.ts Included indictmentReviewerId in the attributes list and added a new model for indictmentReviewer with its associated institution.
apps/judicial-system/web/src/.../fangelsi/akaera/yfirlit/[id].ts A new file that imports IndictmentOverview and exports it as the default.
apps/judicial-system/web/src/.../fangelsi/krafa/yfirlit/[id].ts A new file that imports and exports SignedVerdictOverview.
apps/judicial-system/web/src/pages/fangelsi/krofur.ts Imported PrisonCases and exported it as the default.
apps/judicial-system/web/src/components/FormFooter/FormFooter.tsx Modified FormFooter component's declaration to remove React.PropsWithChildren from the type definition of FC.
apps/judicial-system/web/src/components/.../limitedAccessCase.graphql Added new GraphQL fields related to indictment information and event logs.
apps/judicial-system/web/src/components/Header/Header.tsx Updated logic in HeaderContainer to include a check for isPrisonSystemUser for role-based route determination.
apps/judicial-system/web/src/components/InfoCard/.../DefendantInfo.tsx Added new prop displayVerdictViewDate and updated the component's function signature to include it.
apps/judicial-system/web/src/components/InfoCard/InfoCard.tsx Added displayVerdictViewDate to the Props interface and passed it down to the DefendantCard component.
apps/judicial-system/web/src/components/InfoCard/.../InfoCardClosedIndictment.tsx Enhanced functionality to display indictment review information, including new props displayVerdictViewDate and indictmentReviewedDate.
apps/judicial-system/web/src/routes/Prison/.../IndictmentOverview.tsx Introduced IndictmentOverview React component that renders case indictment details and allows users to view categorized case files.
apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/... Enhanced user redirection logic with role-based routing for prison system users.
apps/judicial-system/web/src/utils/hooks/useCaseList/index.tsx Modified functionality to handle prison system users and updated route assignments based on user types for different case types.
libs/judicial-system/consts/src/lib/consts.ts Introduced new routes for prison users, such as PRISON_CASES_ROUTE, PRISON_SIGNED_VERDICT_OVERVIEW_ROUTE, and PRISON_CLOSED_INDICTMENT_OVERVIEW_ROUTE.
libs/judicial-system/types/src/lib/eventLog.ts Added INDICTMENT_REVIEWED event type to the EventType enum.
apps/judicial-system/web/src/components/.../InfoCardClosedIndictment.spec.ts Updated the value associated with the title 'Ákvörðun' from 'Una' to 'Una dómi' in the getAdditionalDataSections function.

Sequence Diagrams

sequenceDiagram
    participant AuthController
    participant User
    participant RouteHandler
    
    User->>AuthController: Access App
    AuthController->>RouteHandler: Check User Role
    RouteHandler->>User: Route Based on Role (i.e., PRISON_CASES_ROUTE)
Loading
sequenceDiagram
    participant CaseService
    participant Database
    participant EventLogService

    CaseService->>Database: Update Indictment Review Decision
    Database->>CaseService: Indictment Review Decision Updated
    CaseService->>EventLogService: Create INDICTMENT_REVIEWED Event
Loading

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 Jun 26, 2024

Codecov Report

Attention: Patch coverage is 24.48980% with 37 lines in your changes missing coverage. Please review.

Project coverage is 37.03%. Comparing base (541f51b) to head (00a4766).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15357      +/-   ##
==========================================
+ Coverage   37.01%   37.03%   +0.01%     
==========================================
  Files        6554     6543      -11     
  Lines      133952   133215     -737     
  Branches    38339    38211     -128     
==========================================
- Hits        49585    49332     -253     
+ Misses      84367    83883     -484     
Flag Coverage Δ
judicial-system-api 18.17% <33.33%> (+0.01%) ⬆️
judicial-system-formatters 80.50% <100.00%> (+0.09%) ⬆️
judicial-system-message 66.33% <ø> (+0.06%) ⬆️
judicial-system-message-handler 66.10% <100.00%> (+0.03%) ⬆️
judicial-system-types 50.26% <0.00%> (-0.09%) ⬇️
judicial-system-web 28.23% <21.42%> (-0.01%) ⬇️

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

Files Coverage Δ
.../src/app/modules/case/limitedAccessCase.service.ts 72.07% <ø> (ø)
...ystem/web/src/components/FormFooter/FormFooter.tsx 75.00% <100.00%> (ø)
...ts/InfoCard/DefendantInfo/DefendantInfo.strings.ts 100.00% <ø> (ø)
...al-system/web/src/components/InfoCard/InfoCard.tsx 75.55% <ø> (ø)
.../components/InfoCard/InfoCardIndictment.strings.ts 100.00% <ø> (ø)
...al-system/web/src/routes/Shared/Cases/AllCases.tsx 0.00% <ø> (ø)
libs/judicial-system/consts/src/lib/consts.ts 99.01% <100.00%> (+0.04%) ⬆️
libs/judicial-system/types/src/lib/eventLog.ts 100.00% <100.00%> (ø)
...dicial-system/web/src/components/Header/Header.tsx 78.04% <50.00%> (-1.44%) ⬇️
...omponents/InfoCard/DefendantInfo/DefendantInfo.tsx 41.17% <75.00%> (+0.55%) ⬆️
... and 7 more

... and 204 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 541f51b...00a4766. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Jun 26, 2024

Datadog Report

All test runs 470073e 🔗

8 Total Test Services: 1 Failed, 7 Passed
🔻 Test Sessions change in coverage: 1 decreased (-0.1%), 5 increased, 5 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
judicial-system-web 1 0 0 316 0 1m 13.53s 1 no change Link
judicial-system-api 0 0 0 54 0 6.25s 1 increased (+0.03%) Link
judicial-system-backend 0 0 0 19947 0 19m 17.86s 1 increased (+0.01%) Link
judicial-system-formatters 0 0 0 36 0 5.59s 1 increased (+0.07%) Link
judicial-system-message 0 0 0 30 0 11.4s 1 no change Link
judicial-system-message-handler 0 0 0 3 0 4.39s 1 increased (+0.03%) Link
judicial-system-types 0 0 0 23 0 8.21s 1 decreased (-0.1%) Link
judicial-system-xrd-api 0 0 0 6 0 5.68s 1 increased (+0.02%) Link

❌ Failed Tests (1)

  • getAdditionalDataSections should return an object with the reviewer name and the review decision if both are provided - apps/judicial-system/web/src/components/InfoCard/InfoCardClosedIndictment/InfoCardClosedIndictment.spec.ts - Details

    Expand for error
     expect(received).toStrictEqual(expected) // deep equality
     
     - Expected  - 1
     + Received  + 1
     
     @@ -5,10 +5,10 @@
               "title": "Yfirlestur",
               "value": "John Doe",
             },
             Object {
     ...
    

🔻 Code Coverage Decreases vs Default Branch (1)

  • judicial-system-types - jest 54.23% (-0.1%) - Details

unakb and others added 25 commits June 26, 2024 11:30
…n-indictments

	# Conflicts:
	#	apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx
	#
	# It looks like you may be committing a merge.
	# If this is not correct, please run
	#	git update-ref -d MERGE_HEAD
	# and try again.

	# Please enter the commit message for your changes. Lines starting
	# with '#' will be ignored, and an empty message aborts the commit.
	#
	# On branch j-s/prison-indictments
	# All conflicts fixed but you are still merging.
	#
	# Changes to be committed:
	#	modified:   apps/judicial-system/web/src/components/AccordionItems/CaseFilesAccordionItem/CaseFilesAccordionItem.tsx
	#	modified:   apps/judicial-system/web/src/components/AccordionItems/CommentsAccordionItem/CommentsAccordionItem.tsx
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 129bdd3 and 3561100.

Files selected for processing (20)
  • apps/judicial-system/api/src/app/modules/auth/auth.controller.ts (2 hunks)
  • apps/judicial-system/backend/src/app/modules/case/case.service.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts (2 hunks)
  • apps/judicial-system/web/pages/fangelsi/akaera/yfirlit/[id].ts (1 hunks)
  • apps/judicial-system/web/pages/fangelsi/krafa/yfirlit/[id].ts (1 hunks)
  • apps/judicial-system/web/pages/fangelsi/krofur.ts (1 hunks)
  • apps/judicial-system/web/src/components/FormFooter/FormFooter.tsx (1 hunks)
  • apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql (1 hunks)
  • apps/judicial-system/web/src/components/Header/Header.tsx (2 hunks)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.ts (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx (3 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCard.tsx (2 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCardClosedIndictment/InfoCardClosedIndictment.tsx (5 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCardIndictment.strings.ts (1 hunks)
  • apps/judicial-system/web/src/routes/Prison/IndictmentOverview/IndictmentOverview.strings.ts (1 hunks)
  • apps/judicial-system/web/src/routes/Prison/IndictmentOverview/IndictmentOverview.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview.tsx (1 hunks)
  • apps/judicial-system/web/src/utils/hooks/useCaseList/index.tsx (4 hunks)
  • libs/judicial-system/consts/src/lib/consts.ts (1 hunks)
  • libs/judicial-system/types/src/lib/eventLog.ts (1 hunks)
Files skipped from review due to trivial changes (5)
  • apps/judicial-system/web/pages/fangelsi/akaera/yfirlit/[id].ts
  • apps/judicial-system/web/pages/fangelsi/krafa/yfirlit/[id].ts
  • apps/judicial-system/web/pages/fangelsi/krofur.ts
  • apps/judicial-system/web/src/components/FormFooter/FormFooter.tsx
  • apps/judicial-system/web/src/components/InfoCard/InfoCardIndictment.strings.ts
Additional context used
Path-based instructions (15)
libs/judicial-system/types/src/lib/eventLog.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/web/src/routes/Prison/IndictmentOverview/IndictmentOverview.strings.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/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.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/web/src/components/FormProvider/limitedAccessCase.graphql (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/web/src/routes/Prison/IndictmentOverview/IndictmentOverview.tsx (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/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx (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/web/src/components/InfoCard/InfoCardClosedIndictment/InfoCardClosedIndictment.tsx (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/web/src/components/InfoCard/InfoCard.tsx (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/web/src/components/Header/Header.tsx (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/web/src/utils/hooks/useCaseList/index.tsx (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/api/src/app/modules/auth/auth.controller.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."
libs/judicial-system/consts/src/lib/consts.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/modules/case/limitedAccessCase.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."
apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview.tsx (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/case.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."
Learnings (7)
Common learnings
Learnt from: unakb
PR: island-is/island.is#15378
File: apps/judicial-system/web/src/routes/Court/Indictments/Summary/Summary.tsx:86-100
Timestamp: 2024-06-27T14:37:07.823Z
Learning: User unakb prefers explicit case handling in switch statements for key functionalities like `getRulingDecisionTagColor` to ensure clarity and avoid assumptions that a case was overlooked.
apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.ts (1)
Learnt from: gudjong
PR: island-is/island.is#15241
File: apps/judicial-system/backend/src/app/modules/defendant/dto/updateDefendant.dto.ts:87-90
Timestamp: 2024-06-14T15:09:02.068Z
Learning: In some parts of the codebase, `verdictViewDate` is treated as a string, not a Date object, specifically in `updateDefendant.input.ts`, `defendant.model.ts`, and `case.transformer.ts`.
apps/judicial-system/web/src/routes/Prison/IndictmentOverview/IndictmentOverview.tsx (3)
Learnt from: unakb
PR: island-is/island.is#15378
File: apps/judicial-system/web/src/routes/Court/Indictments/Summary/Summary.tsx:86-100
Timestamp: 2024-06-27T14:37:07.823Z
Learning: User unakb prefers explicit case handling in switch statements for key functionalities like `getRulingDecisionTagColor` to ensure clarity and avoid assumptions that a case was overlooked.
Learnt from: unakb
PR: island-is/island.is#14712
File: apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/IndictmentOverview.tsx:0-0
Timestamp: 2024-05-06T18:09:27.876Z
Learning: The judicial system application uses a toaster notification system to handle errors globally.
Learnt from: gudjong
PR: island-is/island.is#15421
File: apps/judicial-system/web/src/routes/Prosecutor/Indictments/Processing/Processing.tsx:55-61
Timestamp: 2024-07-03T15:43:13.884Z
Learning: The `updateCase` method in the `apps/judicial-system/web/src/routes/Prosecutor/Indictments/Processing/Processing.tsx` file has its own error handling, and additional error handling in the `initialize` function is not necessary.
apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx (2)
Learnt from: gudjong
PR: island-is/island.is#15241
File: apps/judicial-system/backend/src/app/modules/defendant/dto/updateDefendant.dto.ts:87-90
Timestamp: 2024-06-14T15:09:02.068Z
Learning: In some parts of the codebase, `verdictViewDate` is treated as a string, not a Date object, specifically in `updateDefendant.input.ts`, `defendant.model.ts`, and `case.transformer.ts`.
Learnt from: unakb
PR: island-is/island.is#14922
File: apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx:43-49
Timestamp: 2024-05-27T10:53:40.687Z
Learning: The `getAppealExpirationInfo` function in `DefendantInfo.tsx` correctly uses `today < expiryDate` to determine if the current date is before the appeal expiration date.
apps/judicial-system/web/src/components/InfoCard/InfoCard.tsx (1)
Learnt from: gudjong
PR: island-is/island.is#15241
File: apps/judicial-system/backend/src/app/modules/defendant/dto/updateDefendant.dto.ts:87-90
Timestamp: 2024-06-14T15:09:02.068Z
Learning: In some parts of the codebase, `verdictViewDate` is treated as a string, not a Date object, specifically in `updateDefendant.input.ts`, `defendant.model.ts`, and `case.transformer.ts`.
apps/judicial-system/web/src/utils/hooks/useCaseList/index.tsx (1)
Learnt from: unakb
PR: island-is/island.is#15378
File: apps/judicial-system/web/src/routes/Court/Indictments/Summary/Summary.tsx:86-100
Timestamp: 2024-06-27T14:37:07.823Z
Learning: User unakb prefers explicit case handling in switch statements for key functionalities like `getRulingDecisionTagColor` to ensure clarity and avoid assumptions that a case was overlooked.
apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview.tsx (1)
Learnt from: unakb
PR: island-is/island.is#15378
File: apps/judicial-system/web/src/routes/Court/Indictments/Summary/Summary.tsx:86-100
Timestamp: 2024-06-27T14:37:07.823Z
Learning: User unakb prefers explicit case handling in switch statements for key functionalities like `getRulingDecisionTagColor` to ensure clarity and avoid assumptions that a case was overlooked.
Additional comments not posted (24)
libs/judicial-system/types/src/lib/eventLog.ts (1)

9-9: LGTM! Verify the usage of the new event type.

The addition of the new event type INDICTMENT_REVIEWED looks good.

However, ensure that this event type is used consistently across the codebase.

Verification successful

Usage of INDICTMENT_REVIEWED Verified

The new event type INDICTMENT_REVIEWED is defined and used in the codebase as expected.

  • Defined in: libs/judicial-system/types/src/lib/eventLog.ts
  • Used in: apps/judicial-system/backend/src/app/modules/case/case.service.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new event type `INDICTMENT_REVIEWED`.

# Test: Search for the usage of the new event type. Expect: Occurrences of `INDICTMENT_REVIEWED`.
rg --type-add 'ts' --type ts 'INDICTMENT_REVIEWED'

Length of output: 108


Script:

#!/bin/bash
# Description: Verify the usage of the new event type `INDICTMENT_REVIEWED`.

# Test: Search for the usage of the new event type. Expect: Occurrences of `INDICTMENT_REVIEWED`.
rg 'INDICTMENT_REVIEWED' --glob '*.ts'

Length of output: 239

apps/judicial-system/web/src/routes/Prison/IndictmentOverview/IndictmentOverview.strings.ts (1)

1-1: LGTM! Verify consistency of message IDs and default messages.

The new message definitions for the indictment overview screen look good.

However, ensure that the message IDs and default messages are consistent with the rest of the application.

apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.ts (1)

26-30: LGTM! Verify consistency of message ID and default message.

The new message definition for the verdict displayed date looks good.

However, ensure that the message ID and default message are consistent with the rest of the application.

Verification successful

No inconsistencies found for message ID and default message.

The message ID judicial.system.core:info_card.defendant_info.verdict_displayed_date and the default message Dómur birtur {date} are only defined in the DefendantInfo.strings.ts file and are not used elsewhere in the codebase.

  • apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.strings.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the consistency of the message ID and default message.

# Test: Search for the message ID and default message. Expect: Consistent usage across the application.
rg --type-add 'ts' --type ts 'judicial.system.core:info_card.defendant_info.verdict_displayed_date'

Length of output: 157


Script:

#!/bin/bash
# Description: Verify the consistency of the message ID and default message.

# Test: Search for the message ID and default message. Expect: Consistent usage across the application.
rg --type-add 'ts:*.ts' 'judicial.system.core:info_card.defendant_info.verdict_displayed_date'

Length of output: 262


Script:

#!/bin/bash
# Description: Verify the consistency of the default message.

# Test: Search for the default message. Expect: Consistent usage across the application.
rg --type-add 'ts:*.ts' 'Dómur birtur {date}'

Length of output: 163


Script:

#!/bin/bash
# Description: Verify the consistency of the default message.

# Test: Search for the default message. Expect: Consistent usage across the application.
rg --type-add 'ts:*.ts' 'Dómur birtur \{date\}'

Length of output: 180

apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql (1)

149-159: LGTM! Verify the usage of the new fields.

The addition of the new fields for indictment review decision, indictment reviewer, and event logs looks good.

However, ensure that these fields are used correctly in the application.

Verification successful

The new fields are correctly used in the application.

The fields indictmentReviewDecision, indictmentReviewer, and eventLogs are integrated and utilized in various parts of the application, indicating proper usage.

  • apps/judicial-system/web/src/components/TagCaseState/TagCaseState.tsx
  • apps/judicial-system/web/src/utils/hooks/useCase/index.ts
  • apps/judicial-system/web/src/routes/Prison/IndictmentOverview/IndictmentOverview.tsx
  • apps/judicial-system/web/src/routes/PublicProsecutor/components/ReviewDecision/ReviewDecision.tsx
  • apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx
  • apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesAwaitingReview.tsx
  • apps/judicial-system/web/src/routes/PublicProsecutor/Indictments/Overview/Overview.tsx
  • apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx
  • apps/judicial-system/web/src/routes/PublicProsecutor/Cases/PublicProsecutorCases.tsx
  • apps/judicial-system/web/src/components/InfoCard/InfoCardIndictment.strings.ts
  • apps/judicial-system/web/src/components/InfoCard/InfoCardClosedIndictment/InfoCardClosedIndictment.tsx
  • apps/judicial-system/web/src/routes/Shared/IndictmentOverview/IndictmentOverview.tsx
  • apps/judicial-system/web/src/routes/CourtOfAppeal/components/CaseOverviewHeader/CaseOverviewHeader.tsx
  • apps/judicial-system/web/src/routes/Court/Indictments/Completed/Completed.tsx
  • apps/judicial-system/web/src/routes/Shared/Cases/Cases.tsx
  • apps/judicial-system/api/src/app/modules/case/interceptors/case.transformer.ts
  • apps/judicial-system/api/src/app/modules/case-list/interceptors/caseList.interceptor.ts
  • apps/judicial-system/api/src/app/modules/case/models/case.model.ts
  • apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts
  • apps/judicial-system/api/src/app/modules/case/dto/updateCase.input.ts
  • apps/judicial-system/backend/src/app/modules/file/file.service.ts
  • apps/judicial-system/backend/src/app/modules/case/pdf.service.ts
  • apps/judicial-system/backend/src/app/modules/case/internalCase.service.ts
  • apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts
  • apps/judicial-system/backend/src/app/modules/case/case.service.ts
  • apps/judicial-system/backend/src/app/modules/case/models/case.model.ts
  • apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts
  • apps/judicial-system/backend/src/app/modules/case/test/internalCaseController/deliverIndictmentInfoToCourt.spec.ts
  • apps/judicial-system/backend/src/app/modules/case/guards/rolesRules.ts
  • apps/judicial-system/backend/src/app/modules/case/filters/cases.filter.ts
  • apps/judicial-system/backend/src/app/modules/case/filters/test/cases.filter.spec.ts
  • apps/judicial-system/backend/src/app/modules/case/dto/updateCase.dto.ts
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new fields in the GraphQL query.

# Test: Search for the usage of the new fields. Expect: Correct usage in the application.
rg --type-add 'graphql' --type graphql 'indictmentReviewDecision|indictmentReviewer|eventLogs'

Length of output: 154


Script:

#!/bin/bash
# Description: Verify the usage of the new fields in the GraphQL query.

# Correctly define the 'graphql' type as '*.graphql' files and search for the usage of the new fields.
rg --type-add 'graphql:*.graphql' --type graphql 'indictmentReviewDecision|indictmentReviewer|eventLogs'

Length of output: 861


Script:

#!/bin/bash
# Description: Verify the usage of the new fields in the TypeScript/JavaScript files.

# Search for the usage of the new fields in TypeScript/JavaScript files.
rg 'indictmentReviewDecision|indictmentReviewer|eventLogs' --type js --type ts

Length of output: 10410

apps/judicial-system/web/src/routes/Prison/IndictmentOverview/IndictmentOverview.tsx (2)

1-24: Imports look good.

The added imports are appropriate and necessary for the functionality of the component.


26-103: Component logic looks good.

The usage of hooks and context is appropriate and aligns with the PR objectives.

apps/judicial-system/web/src/components/InfoCard/DefendantInfo/DefendantInfo.tsx (2)

30-30: Prop addition looks good.

The addition of the displayVerdictViewDate prop is clear and follows TypeScript best practices.


33-40: Prop usage looks good.

The usage of the displayVerdictViewDate prop is correct and aligns with the component's functionality.

Also applies to: 110-116

apps/judicial-system/web/src/components/InfoCard/InfoCardClosedIndictment/InfoCardClosedIndictment.tsx (3)

21-22: Prop additions look good.

The addition of the displayVerdictViewDate and indictmentReviewedDate props is clear and follows TypeScript best practices.


68-73: Prop usage looks good.

The usage of the displayVerdictViewDate and indictmentReviewedDate props is correct and aligns with the component's functionality.


Line range hint 29-57:
Function update looks good.

The update to the getAdditionalDataSections function is correct and ensures that the indictment review details are included in the data sections.

apps/judicial-system/web/src/components/InfoCard/InfoCard.tsx (2)

42-42: Prop addition looks good.

The addition of the displayVerdictViewDate prop to the defendants object is clear and follows TypeScript best practices.


134-134: Prop usage looks good.

The usage of the displayVerdictViewDate prop in the DefendantInfo component is correct and aligns with the component's functionality.

apps/judicial-system/web/src/components/Header/Header.tsx (2)

34-34: Import looks good!

The import of isPrisonSystemUser from @island.is/judicial-system/types is necessary for the new functionality.


100-101: Correct implementation for prison system user routing.

The addition of the condition isPrisonSystemUser(user) to the logoHref assignment ensures that prison system users are correctly routed to constants.PRISON_CASES_ROUTE.

apps/judicial-system/web/src/utils/hooks/useCaseList/index.tsx (2)

18-18: Import looks good!

The import of isPrisonSystemUser from @island.is/judicial-system/types is necessary for the new functionality.


Line range hint 100-124:
Correct implementation for prison system user routing.

The addition of conditions for isPrisonSystemUser(user) within the openCase function ensures that prison system users are correctly routed to their respective routes for completed cases.

apps/judicial-system/api/src/app/modules/auth/auth.controller.ts (2)

31-31: Import looks good!

The import of isPrisonSystemUser from @island.is/judicial-system/types is necessary for the new functionality.


246-247: Correct implementation for prison system user routing.

The addition of the condition isPrisonSystemUser(user) to the authorizeUser method ensures that prison system users are correctly routed to PRISON_CASES_ROUTE.

libs/judicial-system/consts/src/lib/consts.ts (1)

105-108: New routes for prison system users are correctly defined.

The addition of PRISON_CASES_ROUTE, PRISON_SIGNED_VERDICT_OVERVIEW_ROUTE, and PRISON_CLOSED_INDICTMENT_OVERVIEW_ROUTE aligns with the PR objectives and ensures proper routing for prison system users.

apps/judicial-system/backend/src/app/modules/case/limitedAccessCase.service.ts (2)

108-108: Approved: Addition of indictmentReviewerId attribute.

The addition of the indictmentReviewerId attribute to the attributes array is correct.


168-172: Approved: Addition of indictmentReviewer model to include array.

The addition of the indictmentReviewer model and its associated institution to the include array is correct.

apps/judicial-system/web/src/routes/Shared/SignedVerdictOverview/SignedVerdictOverview.tsx (1)

447-453: Approved: Addition of routing logic for prison users.

The addition of routing logic for prison users within the onClick handler of the back button is correct.

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

1489-1497: Ensure completeness of event logging for indictment review decision.

The added logic to handle update.indictmentReviewDecision appears correct and follows the pattern used for other event types. However, ensure that all necessary information is included in the event log.

Ensure that the event log creation for INDICTMENT_REVIEWED is comprehensive and includes all required information.

Copy link
Member

@unakb unakb left a comment

Choose a reason for hiding this comment

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

Just one small comment to consider

@oddsson oddsson added the automerge Merge this PR as soon as all checks pass label Jul 5, 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 3561100 and ccde05a.

Files selected for processing (3)
  • apps/judicial-system/web/pages/fangelsi/krofur.ts (1 hunks)
  • apps/judicial-system/web/src/components/InfoCard/InfoCardIndictment.strings.ts (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/AllCases.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • apps/judicial-system/web/src/routes/Shared/Cases/AllCases.tsx
Files skipped from review as they are similar to previous changes (2)
  • apps/judicial-system/web/pages/fangelsi/krofur.ts
  • apps/judicial-system/web/src/components/InfoCard/InfoCardIndictment.strings.ts

@datadog-island-is
Copy link

datadog-island-is bot commented Jul 5, 2024

Datadog Report

All test runs 597b9c8 🔗

8 Total Test Services: 1 Failed, 7 Passed
🔻 Test Sessions change in coverage: 1 decreased (-0.1%), 5 increased, 5 no change

Test Services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
judicial-system-web 1 0 0 316 0 1m 8.51s 1 no change Link
judicial-system-api 0 0 0 54 0 6.51s 1 increased (+0.03%) Link
judicial-system-backend 0 0 0 19941 0 20m 33.54s 1 increased (+0.01%) Link
judicial-system-formatters 0 0 0 36 0 5.88s 1 increased (+0.07%) Link
judicial-system-message 0 0 0 30 0 12.04s 1 no change Link
judicial-system-message-handler 0 0 0 3 0 4.54s 1 increased (+0.03%) Link
judicial-system-types 0 0 0 23 0 7.51s 1 decreased (-0.1%) Link
judicial-system-xrd-api 0 0 0 6 0 5.14s 1 increased (+0.02%) Link

❌ Failed Tests (1)

  • getAdditionalDataSections should return an object with the reviewer name and the review decision if both are provided - apps/judicial-system/web/src/components/InfoCard/InfoCardClosedIndictment/InfoCardClosedIndictment.spec.ts - Details

    Expand for error
     expect(received).toStrictEqual(expected) // deep equality
     
     - Expected  - 1
     + Received  + 1
     
     @@ -5,10 +5,10 @@
               "title": "Yfirlestur",
               "value": "John Doe",
             },
             Object {
     ...
    

🔻 Code Coverage Decreases vs Default Branch (1)

  • judicial-system-types - jest 54.23% (-0.1%) - 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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ccde05a and 202fc4c.

Files selected for processing (1)
  • apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/judicial-system/web/src/components/FormProvider/limitedAccessCase.graphql

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 202fc4c and 00a4766.

Files selected for processing (1)
  • apps/judicial-system/web/src/components/InfoCard/InfoCardClosedIndictment/InfoCardClosedIndictment.spec.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • apps/judicial-system/web/src/components/InfoCard/InfoCardClosedIndictment/InfoCardClosedIndictment.spec.ts

@kodiakhq kodiakhq bot merged commit 5c1cb82 into main Jul 8, 2024
37 checks passed
@kodiakhq kodiakhq bot deleted the j-s/prison-indictments branch July 8, 2024 09:54
oskarjs pushed a commit that referenced this pull request Aug 20, 2024
* Started working on indictment overview for prisons

* Add indictment completed event type to event log

* feat(j-s): FMST sees relevant indictment cases

* Use event logs for completed indictments

* Allow verdictDisplayedDate in info card

* Add verdictViewDate to ClosedIndictmentInfoCard

* Show indictmentReviewedDate on closedIndictmentInfoCard

* feat(j-s): Prison cases

* fix(j-s): cases filter test

* Update indictmentCase.spec.ts

* feat(j-s): return indictment completed date

* Spesific prison routes

* Add indictmentReviewer to limited access case

* Add footer

* Checkpoint

* Change copy

* Fix build

* Fix tests

---------

Co-authored-by: unakb <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
@coderabbitai coderabbitai bot mentioned this pull request Oct 4, 2024
6 tasks
@coderabbitai coderabbitai bot mentioned this pull request Oct 29, 2024
6 tasks
@coderabbitai coderabbitai bot mentioned this pull request Nov 27, 2024
6 tasks
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