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): Show indictment decision type to public prosecutor users #17079

Merged
merged 9 commits into from
Dec 5, 2024

Conversation

oddsson
Copy link
Member

@oddsson oddsson commented Nov 28, 2024

Show indictment decision type to public prosecutor users

Asana

What

Show either FINE or RULING based on the indictment ruling decision for users at the public prosecutors office

Why

For clarity

Screenshots / Gifs

Screenshot 2024-12-02 at 15 18 57

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

    • Added a court reference to the case list entries, enhancing case data representation.
    • Introduced new tags for case outcomes: 'fineTag' and 'rulingTag' for better localization.
    • Enhanced table components to display case types and court abbreviations, improving user experience.
  • Bug Fixes

    • Improved data retrieval for associated court information in case lists.
  • Documentation

    • Updated GraphQL queries to include court information for cases.
  • Refactor

    • Streamlined sorting and rendering logic in table components for better maintainability.

Copy link
Contributor

coderabbitai bot commented Nov 28, 2024

Walkthrough

The pull request introduces several modifications across multiple files in the judicial system application. Key changes include the addition of a court field to the CaseListEntry class, updates to the caseListInclude constant in the CaseService to include court information, and enhancements to the CaseListInterceptor to return court data. Additionally, new message definitions for case outcomes are added, and the Table components are updated to display case type and court abbreviations. A new GraphQL field for court information is also introduced.

Changes

File Change Summary
apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts Added new field readonly court?: Institution in CaseListEntry class.
apps/judicial-system/backend/src/app/modules/case/case.service.ts Updated caseListInclude to include { model: Institution, as: 'court' }.
apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts Added court property in the return object of the intercept method in CaseListInterceptor.
apps/judicial-system/web/messages/Core/tables.ts Added new messages: fineTag and rulingTag with respective IDs and descriptions.
apps/judicial-system/web/src/components/Table/Table.tsx Added method getColumnValue(entry: CaseListEntry, column: keyof CaseListEntry) for column value retrieval.
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesAwaitingReview.tsx Updated import to include CaseIndictmentRulingDecision, added new column for case type, and included a Tag for ruling decisions.
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx Updated imports, added sortable column for case type, and modified cell rendering for CourtCaseNumber.
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx Added districtCourtAbbreviation function, updated table header for case type, and included a tag for ruling decisions.
apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql Added new field court with subfields id and name in the Cases query.
libs/judicial-system/formatters/src/lib/formatters.ts Added method `districtCourtAbbreviation(courtName?: string

Possibly related PRs

  • feat(j-s): Table for reviewed cases #14778: This PR adds a new field indictmentReviewDecision to the CaseListEntry class in caseList.model.ts, which is directly related to the changes made in the main PR that introduced a new field court in the same class.
  • feat(j-s): Indictment dismissal and cancelation #14984: This PR also adds a new property indictmentRulingDecision to the CaseListEntry class in caseList.model.ts, which is relevant as it modifies the same class that was updated in the main PR.
  • fix(j-s): Merge Email #16011: This PR introduces a new ruling decision type WITHDRAWAL in the CaseService class, which is relevant as it relates to the handling of decisions in the context of cases, similar to the changes made in the main PR regarding the CaseListEntry.
  • fix(j-s): Withdraw Indictment Case #16525: This PR modifies the handling of indictment cases to include a new ruling decision type WITHDRAWAL, which is relevant as it pertains to the same context of case management and decision handling introduced in the main PR.
  • fix(j-s): Display correct verdict appeal info for defenders  #16533: This PR updates the display of verdict appeal information for defenders, which is related to the changes in the main PR that introduces a new field in the CaseListEntry class, enhancing the information available for cases.
  • feat(j-s): Deliver Confirmed Indictment Ruling to Court #17104: This PR enhances the message delivery logic for completed indictment cases, which is relevant as it deals with the same context of case handling as the main PR that modifies the CaseListEntry class.

Suggested reviewers

  • unakb

📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 909ba03 and 4ed6f40.

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

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

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 20.00000% with 48 lines in your changes missing coverage. Please review.

Project coverage is 35.77%. Comparing base (2421d10) to head (4ed6f40).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...s/judicial-system/formatters/src/lib/formatters.ts 20.00% 16 Missing ⚠️
.../routes/PublicProsecutor/Tables/CasesForReview.tsx 0.00% 11 Missing ⚠️
...c/routes/PublicProsecutor/Tables/CasesReviewed.tsx 0.00% 11 Missing ⚠️
...judicial-system/web/src/components/Table/Table.tsx 66.66% 4 Missing ⚠️
...es/PublicProsecutor/Tables/CasesAwaitingReview.tsx 0.00% 4 Missing ⚠️
...src/app/modules/case-list/models/caseList.model.ts 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17079      +/-   ##
==========================================
+ Coverage   35.75%   35.77%   +0.02%     
==========================================
  Files        6925     6951      +26     
  Lines      147610   148059     +449     
  Branches    42030    42189     +159     
==========================================
+ Hits        52775    52966     +191     
- Misses      94835    95093     +258     
Flag Coverage Δ
judicial-system-api 19.98% <0.00%> (-0.02%) ⬇️
judicial-system-backend 55.72% <5.00%> (-0.05%) ⬇️
judicial-system-formatters 78.09% <5.00%> (-1.50%) ⬇️
judicial-system-web 27.92% <20.68%> (-0.05%) ⬇️

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

Files with missing lines Coverage Δ
...ystem/backend/src/app/modules/case/case.service.ts 90.34% <ø> (ø)
.../modules/case/interceptors/caseList.interceptor.ts 46.66% <ø> (ø)
apps/judicial-system/web/messages/Core/tables.ts 100.00% <ø> (ø)
...src/app/modules/case-list/models/caseList.model.ts 0.00% <0.00%> (ø)
...judicial-system/web/src/components/Table/Table.tsx 64.13% <66.66%> (-2.92%) ⬇️
...es/PublicProsecutor/Tables/CasesAwaitingReview.tsx 5.55% <0.00%> (-0.70%) ⬇️
.../routes/PublicProsecutor/Tables/CasesForReview.tsx 0.00% <0.00%> (ø)
...c/routes/PublicProsecutor/Tables/CasesReviewed.tsx 0.00% <0.00%> (ø)
...s/judicial-system/formatters/src/lib/formatters.ts 70.98% <20.00%> (-5.00%) ⬇️

... and 213 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 2421d10...4ed6f40. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Nov 28, 2024

Datadog Report

All test runs 9a5cdf9 🔗

9 Total Test Services: 0 Failed, 9 Passed
🔻 Test Sessions change in coverage: 4 decreased, 11 no change

Test 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.91s 1 no change Link
application-system-api 0 0 0 46 0 2m 24.15s 1 no change Link
application-template-api-modules 0 0 0 118 0 2m 48.93s 1 no change Link
application-ui-shell 0 0 0 74 0 40.39s 1 no change Link
judicial-system-api 0 0 0 61 0 6.59s 1 no change Link
judicial-system-backend 0 0 0 21346 0 22m 24.17s 1 decreased (-0.03%) Link
judicial-system-formatters 0 0 0 38 0 5.57s 1 decreased (-1.01%) Link
judicial-system-web 0 0 0 332 0 1m 10.22s 1 decreased (-0.02%) Link
judicial-system-xrd-api 0 0 0 6 0 5.33s 1 decreased (-0.52%) Link

🔻 Code Coverage Decreases vs Default Branch (4)

  • judicial-system-formatters - jest 87.13% (-1.01%) - Details
  • judicial-system-xrd-api - jest 74.6% (-0.52%) - Details
  • judicial-system-backend - jest 59.4% (-0.03%) - Details
  • judicial-system-web - jest 32.56% (-0.02%) - Details

@oddsson oddsson changed the title J s/decision type feat(j-s): Show indictment decision type to public prosecutor users Dec 2, 2024
@oddsson oddsson marked this pull request as ready for review December 2, 2024 15:20
@oddsson oddsson requested a review from a team as a code owner December 2, 2024 15:20
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 (9)
apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql (1)

37-40: LGTM! Consider updating GraphQL documentation.

The addition of the court field is well-structured and aligns with the query's organization. Since this is a schema change, consider updating the GraphQL documentation to reflect this new field.

apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts (1)

80-82: LGTM! Consider adding test coverage.

The court field is properly typed and decorated. Since this is a model change, consider adding test cases to verify the serialization and deserialization of the new field.

apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesAwaitingReview.tsx (1)

81-92: Consider accessibility implications of disabled Tag.

While the Tag component implementation correctly displays the decision type, using the disabled prop might affect accessibility by reducing contrast and potentially making it harder to read.

Consider removing the disabled prop and using appropriate styling to maintain visual hierarchy without compromising accessibility:

-                    <Tag variant="darkerBlue" outlined disabled>
+                    <Tag variant="darkerBlue" outlined>
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx (2)

82-96: Consider extracting court abbreviation formatting logic.

The court abbreviation formatting logic could be moved to a separate utility function to improve reusability and maintainability.

Consider creating a utility function:

+const formatCourtCaseNumber = (courtName: string | undefined, caseNumber: string | undefined) => {
+  const courtAbbreviation = districtCourtAbbreviation(courtName)
+  return `${courtAbbreviation ? `${courtAbbreviation}: ` : ''}${caseNumber ?? ''}`
+}

// In the component:
-                  cell: (row) => {
-                    const courtAbbreviation = districtCourtAbbreviation(
-                      row.court?.name,
-                    )
-
-                    return (
-                      <CourtCaseNumber
-                        courtCaseNumber={`${
-                          courtAbbreviation ? `${courtAbbreviation}: ` : ''
-                        }${row.courtCaseNumber ?? ''}`}
-                        policeCaseNumbers={row.policeCaseNumbers ?? []}
-                        appealCaseNumber={row.appealCaseNumber ?? ''}
-                      />
-                    )
-                  },
+                  cell: (row) => (
+                    <CourtCaseNumber
+                      courtCaseNumber={formatCourtCaseNumber(row.court?.name, row.courtCaseNumber)}
+                      policeCaseNumbers={row.policeCaseNumbers ?? []}
+                      appealCaseNumber={row.appealCaseNumber ?? ''}
+                    />
+                  ),

101-112: Consider accessibility implications of disabled Tag.

Similar to CasesAwaitingReview.tsx, the Tag component's disabled prop might affect accessibility.

Consider removing the disabled prop:

-                    <Tag variant="darkerBlue" outlined disabled>
+                    <Tag variant="darkerBlue" outlined>
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx (1)

117-147: Consider adding fallback for missing court data

The implementation correctly displays court abbreviations and ruling decisions. However, consider adding a comment when both court name and court case number are missing.

 cell: (row) => {
   const courtAbbreviation = districtCourtAbbreviation(
     row.court?.name,
   )
+  if (!courtAbbreviation && !row.courtCaseNumber) {
+    return <Text color="red">No case number available</Text>
+  }
   return (
     <CourtCaseNumber
       courtCaseNumber={`${
         courtAbbreviation ? `${courtAbbreviation}: ` : ''
       }${row.courtCaseNumber ?? ''}`}
       policeCaseNumbers={row.policeCaseNumbers ?? []}
       appealCaseNumber={row.appealCaseNumber ?? ''}
     />
   )
 },
apps/judicial-system/web/src/components/Table/Table.tsx (1)

174-190: Enhance type safety for column key handling

The getColumnValue function works correctly but could benefit from stronger typing.

-  column: keyof CaseListEntry,
+  column: 'defendants' | 'courtCaseNumber' | keyof CaseListEntry,

This would make it clearer which columns have special handling and prevent potential runtime errors.

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

221-242: Enhance type safety and maintainability of court abbreviations

The function works correctly but could benefit from TypeScript enums or constants for court names.

+const enum DistrictCourt {
+  REYKJAVIK = 'Héraðsdómur Reykjavíkur',
+  REYKJANES = 'Héraðsdómur Reykjaness',
+  // ... other courts
+}
+
+const COURT_ABBREVIATIONS: Record<DistrictCourt, string> = {
+  [DistrictCourt.REYKJAVIK]: 'HDR',
+  [DistrictCourt.REYKJANES]: 'HDRN',
+  // ... other mappings
+}
+
 export const districtCourtAbbreviation = (courtName?: string | null) => {
-  switch (courtName) {
-    case 'Héraðsdómur Reykjavíkur':
-      return 'HDR'
-    // ... other cases
-    default:
-      return ''
-  }
+  return COURT_ABBREVIATIONS[courtName as DistrictCourt] ?? ''
 }

This approach would:

  1. Prevent typos in court names
  2. Make maintenance easier
  3. Enable better IDE support
apps/judicial-system/backend/src/app/modules/case/case.service.ts (1)

412-412: Consider grouping related institution includes together.

For better code organization, consider moving the court include next to the prosecutorsOffice include since they are both Institution models.

-  { model: Institution, as: 'court' },
   { model: Institution, as: 'prosecutorsOffice' },
+  { model: Institution, as: 'court' },
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d8e5cd2 and 1794dbb.

📒 Files selected for processing (10)
  • apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/case/case.service.ts (1 hunks)
  • apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts (1 hunks)
  • apps/judicial-system/web/messages/Core/tables.ts (1 hunks)
  • apps/judicial-system/web/src/components/Table/Table.tsx (2 hunks)
  • apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesAwaitingReview.tsx (5 hunks)
  • apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx (5 hunks)
  • apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx (2 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql (1 hunks)
  • libs/judicial-system/formatters/src/lib/formatters.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (10)
apps/judicial-system/api/src/app/modules/case-list/models/caseList.model.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/interceptors/caseList.interceptor.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/Cases/cases.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."
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/web/src/routes/PublicProsecutor/Tables/CasesReviewed.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/Table/Table.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/messages/Core/tables.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/PublicProsecutor/Tables/CasesAwaitingReview.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/routes/PublicProsecutor/Tables/CasesForReview.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 (3)
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx (3)
Learnt from: oddsson
PR: island-is/island.is#14673
File: apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx:79-79
Timestamp: 2024-11-12T15:15:11.835Z
Learning: The implementation of `mapIndictmentCaseStateToTagVariant` in `TagCaseState.tsx`, which maps only `CaseState.ACCEPTED` to a specific tag and defaults others to an "unknown" status, is intentional as per the application's requirements.
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-11-12T15:15:11.835Z
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: gudjong
PR: island-is/island.is#16760
File: apps/judicial-system/web/src/routes/Shared/Cases/PrisonCases.tsx:112-118
Timestamp: 2024-11-12T15:15:11.835Z
Learning: In `apps/judicial-system/web/src/routes/Prosecutor/components/CasesAwaitingConfirmationTable/CasesAwaitingConfirmationTable.tsx`, `apps/judicial-system/web/src/routes/Court/components/CasesAwaitingAssignmentTable/CasesAwaitingAssignmentTable.tsx`, and one instance in `apps/judicial-system/web/src/routes/Shared/Cases/PrisonCases.tsx`, it's correct to pass only the `type` prop to `ColumnCaseType` without the `decision` and `parentCaseId` props.
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesAwaitingReview.tsx (4)
Learnt from: oddsson
PR: island-is/island.is#14673
File: apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx:79-79
Timestamp: 2024-11-12T15:15:11.835Z
Learning: The implementation of `mapIndictmentCaseStateToTagVariant` in `TagCaseState.tsx`, which maps only `CaseState.ACCEPTED` to a specific tag and defaults others to an "unknown" status, is intentional as per the application's requirements.
Learnt from: oddsson
PR: island-is/island.is#16939
File: apps/judicial-system/web/src/components/Table/PastCasesTable/PastCasesTable.tsx:126-131
Timestamp: 2024-11-19T21:47:09.093Z
Learning: The `CaseListEntry` interface in `@island.is/judicial-system-web/src/graphql/schema` includes the properties `isValidToDateInThePast`, `indictmentRulingDecision`, and `indictmentDecision`.
Learnt from: gudjong
PR: island-is/island.is#16760
File: apps/judicial-system/web/src/routes/Shared/Cases/PrisonCases.tsx:112-118
Timestamp: 2024-11-12T15:15:11.835Z
Learning: In `apps/judicial-system/web/src/routes/Prosecutor/components/CasesAwaitingConfirmationTable/CasesAwaitingConfirmationTable.tsx`, `apps/judicial-system/web/src/routes/Court/components/CasesAwaitingAssignmentTable/CasesAwaitingAssignmentTable.tsx`, and one instance in `apps/judicial-system/web/src/routes/Shared/Cases/PrisonCases.tsx`, it's correct to pass only the `type` prop to `ColumnCaseType` without the `decision` and `parentCaseId` props.
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-11-12T15:15:11.835Z
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/PublicProsecutor/Tables/CasesForReview.tsx (3)
Learnt from: oddsson
PR: island-is/island.is#14673
File: apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx:79-79
Timestamp: 2024-11-12T15:15:11.835Z
Learning: The implementation of `mapIndictmentCaseStateToTagVariant` in `TagCaseState.tsx`, which maps only `CaseState.ACCEPTED` to a specific tag and defaults others to an "unknown" status, is intentional as per the application's requirements.
Learnt from: oddsson
PR: island-is/island.is#16939
File: apps/judicial-system/web/src/components/Table/PastCasesTable/PastCasesTable.tsx:126-131
Timestamp: 2024-11-19T21:47:09.093Z
Learning: The `CaseListEntry` interface in `@island.is/judicial-system-web/src/graphql/schema` includes the properties `isValidToDateInThePast`, `indictmentRulingDecision`, and `indictmentDecision`.
Learnt from: gudjong
PR: island-is/island.is#16760
File: apps/judicial-system/web/src/routes/Shared/Cases/PrisonCases.tsx:112-118
Timestamp: 2024-11-12T15:15:11.835Z
Learning: In `apps/judicial-system/web/src/routes/Prosecutor/components/CasesAwaitingConfirmationTable/CasesAwaitingConfirmationTable.tsx`, `apps/judicial-system/web/src/routes/Court/components/CasesAwaitingAssignmentTable/CasesAwaitingAssignmentTable.tsx`, and one instance in `apps/judicial-system/web/src/routes/Shared/Cases/PrisonCases.tsx`, it's correct to pass only the `type` prop to `ColumnCaseType` without the `decision` and `parentCaseId` props.
🔇 Additional comments (9)
apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts (1)

67-67: Verify that court information is non-sensitive data.

Given the warning comment about sensitive information in this interceptor, please confirm that court information is safe to expose in the case list endpoint.

✅ Verification successful

Let me gather more specific information about the court data sensitivity.


Court information is safe to expose in the case list endpoint

The interceptor file explicitly includes a warning comment about sensitive information and provides a whitelist of safe fields to return. The court field has been deliberately added to this whitelist, indicating it has been reviewed and deemed non-sensitive. The comment also specifies that a separate endpoint should be created if sensitive information needs to be exposed to specific roles.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any security-related comments or documentation about court data sensitivity
rg -i "sensitive|security|private" --type ts

Length of output: 67632


Script:

#!/bin/bash
# Search for any security-related comments or documentation specifically about court data
rg -i "court.*sensitive|sensitive.*court" --type ts

# Search for the interceptor file to see the warning comment about sensitive data
cat apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts

Length of output: 3328

apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesAwaitingReview.tsx (3)

5-5: LGTM! Import statements are well-organized.

The new imports are necessary for implementing the indictment decision type display functionality and follow NextJS best practices.

Also applies to: 21-24


54-54: LGTM! Table header addition is appropriate.

The new column for case type enhances the UI by providing clear visibility of the indictment decision type to public prosecutor users, which aligns with the PR objectives.


65-67: LGTM! Context menu implementation is simplified.

The refactoring improves code readability while maintaining the same functionality.

apps/judicial-system/web/messages/Core/tables.ts (1)

137-147: LGTM! Message definitions are well-structured.

The new message definitions for fine and ruling tags follow the established pattern, include clear descriptions, and support proper localization.

apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx (3)

6-9: LGTM: Import changes are well-organized

The addition of districtCourtAbbreviation is properly grouped with other formatter imports.


95-98: LGTM: Table configuration enhances user experience

The addition of sorting capability for court case numbers and the new case type column improves data organization and visibility.

Also applies to: 106-106


112-114: LGTM: Context menu generation simplified

The refactoring to use arrow function syntax improves code conciseness while maintaining functionality.

apps/judicial-system/web/src/components/Table/Table.tsx (1)

9-12: LGTM: Import changes are well-organized

The addition of districtCourtAbbreviation is properly grouped with other date-related formatters.

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.

Nice, probably best to merge this after the court abbreviation PR.

@oddsson oddsson added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Dec 5, 2024
@kodiakhq kodiakhq bot merged commit 090c75d into main Dec 5, 2024
38 checks passed
@kodiakhq kodiakhq bot deleted the j-s/decision-type branch December 5, 2024 22:11
thorhildurt pushed a commit that referenced this pull request Dec 11, 2024
…17079)

* Add court abbr to getAllCases call

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Add indictment decision to tables

---------

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