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 district court abbreviation on mobile #17075

Merged
merged 12 commits into from
Dec 6, 2024
Merged

Conversation

oddsson
Copy link
Member

@oddsson oddsson commented Nov 28, 2024

Show district court abbreviation for public prosecutor

Asana

What

In the case list for public prosecutor, show a abbreviation of the district court's name with the court case number.

Why

The staff at the public prosecutors need to see which district court sent a case

Screenshots / Gifs

Screenshot 2024-11-28 at 13 41 15

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

Release Notes

  • New Features

    • Added a court property to case entries, enhancing data related to court associations.
    • Introduced districtCourtAbbreviation function for improved display of court case numbers.
    • Enhanced GraphQL query for cases to include court information.
  • Improvements

    • Table components now allow sorting by case number and other relevant fields for better user interaction.
    • Improved rendering logic for displaying court case numbers with abbreviations for clarity.

@oddsson oddsson requested a review from a team as a code owner November 28, 2024 13:41
Copy link
Contributor

coderabbitai bot commented Nov 28, 2024

Caution

Review failed

The head commit changed during the review from 993bba8 to 13f100e.

Walkthrough

The pull request introduces changes across multiple files in the judicial system application. A new court field is added to the CaseListEntry model, allowing for the inclusion of court information. The CaseService is updated to include this new field in data retrieval, while the CaseListInterceptor enhances the returned data structure. Front-end components are modified to utilize a new utility function for displaying court case numbers with abbreviations, and a new field is added to the GraphQL query for cases to retrieve court-related information.

Changes

File Path 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 add { 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.
apps/judicial-system/web/src/components/Table/Table.tsx Added method getColumnValue(entry: CaseListEntry, column: keyof CaseListEntry) for value retrieval.
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx Updated cell rendering to include district court abbreviation and added sortable properties.
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx Added districtCourtAbbreviation function and sortable property for courtCaseNumber.
apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql Added field court { id name } to the GraphQL query for cases.
libs/judicial-system/formatters/src/lib/formatters.ts Added function `districtCourtAbbreviation(courtName?: string
apps/judicial-system/web/src/routes/Shared/Cases/MobileCase.tsx Added variable const courtAbbreviation in MobileCase component to utilize districtCourtAbbreviation.

Possibly related PRs

Suggested labels

automerge

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

🧹 Outside diff range and nitpick comments (9)
apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts (2)

67-67: Add type annotation for better type safety

Consider explicitly typing the returned object to ensure type safety. This helps catch potential type mismatches during compilation.

-            court: theCase.court,
+            court: theCase.court as Institution | null,

67-67: Update API documentation

The PR objectives mention that documentation updates are pending. Please ensure the API documentation is updated to reflect this new field in the response.

Would you like me to help generate the documentation for this new field?

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

80-82: Consider grouping related institution fields together.

For better code organization and maintainability, consider moving the court field next to other institution-related fields like prosecutorsOffice. This would make it easier to maintain related fields in the future.

  @Field(() => User, { nullable: true })
  readonly registrar?: User

  @Field(() => ID, { nullable: true })
  readonly parentCaseId?: string

+ @Field(() => Institution, { nullable: true })
+ readonly court?: Institution
+
  @Field(() => CaseAppealState, { nullable: true })
  readonly appealState?: CaseAppealState

  @Field(() => String, { nullable: true })
  readonly appealedDate?: string

  @Field(() => String, { nullable: true })
  readonly appealCaseNumber?: string

  @Field(() => CaseAppealRulingDecision, { nullable: true })
  readonly appealRulingDecision?: CaseAppealRulingDecision

  @Field(() => Institution, { nullable: true })
  readonly prosecutorsOffice?: Institution

- @Field(() => Institution, { nullable: true })
- readonly court?: Institution
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx (1)

78-92: Consider extracting the template string for better readability.

The implementation correctly handles the district court abbreviation display and null cases. However, the template string could be made more readable.

Consider this minor readability improvement:

   cell: (row) => {
     const courtAbbreviation = districtCourtAbbreviation(
       row.court?.name,
     )
+    const formattedCaseNumber = `${
+      courtAbbreviation ? `${courtAbbreviation}: ` : ''
+    }${row.courtCaseNumber ?? ''}`
 
     return (
       <CourtCaseNumber
-        courtCaseNumber={`${
-          courtAbbreviation ? `${courtAbbreviation}: ` : ''
-        }${row.courtCaseNumber ?? ''}`}
+        courtCaseNumber={formattedCaseNumber}
         policeCaseNumbers={row.policeCaseNumbers ?? []}
         appealCaseNumber={row.appealCaseNumber ?? ''}
       />
     )
   },
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx (1)

116-130: Consider memoizing the court abbreviation.

The implementation correctly displays the district court abbreviation with the case number. However, for better performance, consider memoizing the abbreviation computation to prevent unnecessary recalculations during re-renders.

 cell: (row) => {
+  const courtAbbreviation = useMemo(
+    () => districtCourtAbbreviation(row.court?.name),
+    [row.court?.name]
+  )
-  const courtAbbreviation = districtCourtAbbreviation(
-    row.court?.name,
-  )

   return (
     <CourtCaseNumber
       courtCaseNumber={`${
         courtAbbreviation ? `${courtAbbreviation}: ` : ''
       }${row.courtCaseNumber ?? ''}`}
       policeCaseNumbers={row.policeCaseNumbers ?? []}
       appealCaseNumber={row.appealCaseNumber ?? ''}
     />
   )
 },
apps/judicial-system/web/src/components/Table/Table.tsx (2)

174-190: Consider enhancing type safety and error handling

The getColumnValue function is well-structured but could benefit from additional type safety and error handling.

Consider these improvements:

 const getColumnValue = (
   entry: CaseListEntry,
   column: keyof CaseListEntry,
-) => {
+): string => {
+  if (!entry) {
+    return '';
+  }
+
   const courtAbbreviation = districtCourtAbbreviation(entry.court?.name)

   switch (column) {
     case 'defendants':
-      return entry.defendants?.[0]?.name ?? ''
+      return entry.defendants && entry.defendants.length > 0
+        ? entry.defendants[0].name ?? ''
+        : ''
     case 'courtCaseNumber':
       return courtAbbreviation
         ? `${courtAbbreviation}: ${entry.courtCaseNumber}`
         : entry.courtCaseNumber ?? ''
     default:
-      return entry[column]?.toString() ?? ''
+      const value = entry[column]
+      return value !== null && value !== undefined ? value.toString() : ''
   }
 }

These changes:

  • Add explicit return type
  • Add null check for entry parameter
  • Improve array bounds checking for defendants
  • Enhance null/undefined handling in default case

195-197: Consider memoizing sort callback for better performance

While the sorting implementation is correct, consider extracting and memoizing the comparison callback to prevent unnecessary recreations.

Here's a suggested improvement:

const sortCallback = useCallback(
  (a: CaseListEntry, b: CaseListEntry) => {
    const compareResult = compareLocaleIS(
      getColumnValue(a, sortConfig.column),
      getColumnValue(b, sortConfig.column),
    )
    return sortConfig.direction === 'ascending'
      ? compareResult
      : -compareResult
  },
  [sortConfig]
)

useMemo(() => {
  if (sortConfig) {
    data.sort(sortCallback)
  }
}, [data, sortCallback])
libs/judicial-system/formatters/src/lib/formatters.ts (1)

221-242: LGTM! Consider TypeScript improvements for better type safety.

The implementation is clean and handles all district courts in Iceland. Consider these TypeScript improvements:

+type DistrictCourt =
+  | 'Héraðsdómur Reykjavíkur'
+  | 'Héraðsdómur Reykjaness'
+  | 'Héraðsdómur Vesturlands'
+  | 'Héraðsdómur Suðurlands'
+  | 'Héraðsdómur Norðurlands eystra'
+  | 'Héraðsdómur Norðurlands vestra'
+  | 'Héraðsdómur Austurlands'
+  | 'Héraðsdómur Vestfjarða';

+const DISTRICT_COURTS: { [key in DistrictCourt]: string } = {
+  'Héraðsdómur Reykjavíkur': 'HDR',
+  'Héraðsdómur Reykjaness': 'HDRN',
+  'Héraðsdómur Vesturlands': 'HDV',
+  'Héraðsdómur Suðurlands': 'HDS',
+  'Héraðsdómur Norðurlands eystra': 'HDNE',
+  'Héraðsdómur Norðurlands vestra': 'HDNV',
+  'Héraðsdómur Austurlands': 'HDA',
+  'Héraðsdómur Vestfjarða': 'HDVF'
+};

-export const districtCourtAbbreviation = (courtName?: string | null) => {
+export const districtCourtAbbreviation = (courtName?: DistrictCourt | null): string => {
-  switch (courtName) {
-    case 'Héraðsdómur Reykjavíkur':
-      return 'HDR'
-    case 'Héraðsdómur Reykjaness':
-      return 'HDRN'
-    case 'Héraðsdómur Vesturlands':
-      return 'HDV'
-    case 'Héraðsdómur Suðurlands':
-      return 'HDS'
-    case 'Héraðsdómur Norðurlands eystra':
-      return 'HDNE'
-    case 'Héraðsdómur Norðurlands vestra':
-      return 'HDNV'
-    case 'Héraðsdómur Austurlands':
-      return 'HDA'
-    case 'Héraðsdómur Vestfjarða':
-      return 'HDVF'
-    default:
-      return ''
-  }
+  return courtName ? DISTRICT_COURTS[courtName] ?? '' : '';
}

This refactor:

  1. Adds type safety with a union type for court names
  2. Moves court abbreviations to a constant object
  3. Simplifies the implementation
  4. Makes it easier to maintain and update court mappings
apps/judicial-system/backend/src/app/modules/case/case.service.ts (1)

411-411: LGTM! Consider enhancing type safety.

The addition of court institution to the case list include is correct and aligns with the feature requirements.

Consider defining a type-safe constant for the relationship alias to prevent typos and improve maintainability:

const INSTITUTION_RELATIONS = {
  COURT: 'court',
  PROSECUTORS_OFFICE: 'prosecutorsOffice',
} as const;

// Then use it in the include array
{ model: Institution, as: INSTITUTION_RELATIONS.COURT }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6a313ad and b2b82b4.

📒 Files selected for processing (8)
  • 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/src/components/Table/Table.tsx (2 hunks)
  • apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx (3 hunks)
  • apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx (3 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 (8)
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/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."
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/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/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/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/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."
📓 Learnings (2)
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx (2)
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: 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/CasesReviewed.tsx (1)
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.
🔇 Additional comments (11)
apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql (2)

37-40: Verify court fields for abbreviation feature.

Please confirm that id and name are sufficient for generating the district court abbreviation. Are there any additional fields needed for the abbreviation logic?

✅ Verification successful

Let me search for the implementation of the districtCourtAbbreviation function to verify the required fields.


The court fields are sufficient for the abbreviation feature

The districtCourtAbbreviation function only requires the court's name field to generate the abbreviation. The id field is not used in the abbreviation logic, but it's still useful to keep for other purposes. No additional fields are needed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Look for the abbreviation utility function to verify required fields

# Find files containing district court abbreviation logic
rg -A 5 "districtCourtAbbreviation" apps/judicial-system/web/src/

Length of output: 4126


Script:

#!/bin/bash
# Search for the implementation of districtCourtAbbreviation
rg -l "export.*districtCourtAbbreviation" libs/

Length of output: 103


Script:

#!/bin/bash
# Get the implementation of districtCourtAbbreviation function
rg -A 10 "export.*districtCourtAbbreviation" libs/judicial-system/formatters/src/lib/formatters.ts

Length of output: 459


37-40: Consider query optimization to prevent over-fetching.

The addition of the court field looks good. However, since this query is used in the shared cases route, we should verify that we're not over-fetching court data in components that don't need it.

apps/judicial-system/backend/src/app/modules/case/interceptors/caseList.interceptor.ts (1)

67-67: Verify security implications of exposing court information

Given the warning comment about sensitive information, we should verify that exposing the court field is safe for all user roles accessing this endpoint.

✅ Verification successful

Court information is safe to expose in the case list endpoint

Based on the evidence found:

  1. The court field is already exposed in multiple test cases and endpoints, indicating it's considered public information
  2. The interceptor's warning comment specifically mentions to be careful with "sensitive information", but the PR objectives indicate this is for showing district court abbreviation to public prosecutors
  3. The CaseListInterceptor is used with a public API endpoint (@controller('api')) and already exposes several non-sensitive case fields
  4. The court information appears to be basic institutional data (name/abbreviation) rather than sensitive case details
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any access control or authorization checks related to court information
rg -l "court.*sensitive" apps/judicial-system
rg -l "Institution.*sensitive" apps/judicial-system

# Search for related authorization decorators or guards
ast-grep --pattern 'class $_ implements $_ {
  $$$
  @Roles($_)
  $$$
}'

Length of output: 176


Script:

#!/bin/bash
# Let's try a broader search for authorization and court-related code
# Search for role-based access control
rg -A 5 "@Roles\(" apps/judicial-system/backend

# Search for court-related models and DTOs to understand the data structure
rg -l "class.*Court" apps/judicial-system/backend
fd Court.ts apps/judicial-system/backend

# Search for the Institution type definition
fd Institution.ts apps/judicial-system/backend
rg -A 5 "interface Institution" apps/judicial-system/backend

# Check the interceptor's usage context
rg -A 5 "CaseListInterceptor" apps/judicial-system/backend

Length of output: 2778


Script:

#!/bin/bash
# Let's examine the Case model and its usage
rg -A 10 "class Case" apps/judicial-system/backend
rg -A 10 "interface Case" apps/judicial-system/backend

# Check if court information is exposed in other public endpoints
rg -A 5 "@Public\(" apps/judicial-system/backend

# Look for existing court-related properties in responses
rg "court:" apps/judicial-system/backend/src/app/modules/case

# Check the controller's role decorators
rg -A 5 "@Controller\(" apps/judicial-system/backend/src/app/modules/case/case.controller.ts

Length of output: 26680

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

80-82: LGTM! The new court field is well-implemented.

The field is properly typed as Institution and correctly marked as nullable using GraphQL decorators, which aligns with the PR objectives of displaying district court information.

apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesForReview.tsx (2)

6-10: LGTM! Import changes are well-structured.

The addition of districtCourtAbbreviation to the existing formatter imports maintains good code organization.


48-51: LGTM! Sortable configuration enhances table usability.

The addition of sorting capability for the court case number column follows the established pattern and improves user experience for public prosecutors managing multiple cases.

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

6-9: LGTM! Clean import organization.

The addition of districtCourtAbbreviation is well-organized within the existing formatter imports.


95-98: LGTM! Sorting enhancement improves usability.

The addition of sorting capability for court case numbers will help prosecutors better organize their case list.

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

9-12: LGTM: Clean import organization

The addition of districtCourtAbbreviation is well-organized, grouped appropriately with related formatting utilities.

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

221-242: Implementation aligns perfectly with PR objectives.

The districtCourtAbbreviation function effectively supports the PR's goal of helping public prosecutor staff identify district courts by providing clear, consistent abbreviations. The implementation in the formatters library ensures it can be reused across different parts of the application.

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

411-411: Well-integrated change with existing functionality.

The addition of court information to case lists is cleanly implemented and maintains consistency with the existing pattern of eager loading relationships. The change effectively supports the requirement to display district court information while preserving the service's existing behavior.

apps/judicial-system/web/src/components/Table/Table.tsx Outdated Show resolved Hide resolved
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

Attention: Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.

Project coverage is 35.70%. Comparing base (fe1b1eb) to head (3a2b39e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...-system/web/src/routes/Shared/Cases/MobileCase.tsx 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17075      +/-   ##
==========================================
- Coverage   35.73%   35.70%   -0.04%     
==========================================
  Files        6926     6924       -2     
  Lines      147691   148391     +700     
  Branches    42073    42371     +298     
==========================================
+ Hits        52775    52979     +204     
- Misses      94916    95412     +496     
Flag Coverage Δ
air-discount-scheme-web 0.00% <ø> (ø)
api 3.33% <ø> (ø)
api-domains-education 31.23% <ø> (ø)
application-api-files 61.86% <ø> (ø)
application-core 76.01% <ø> (ø)
application-system-api 38.76% <ø> (-0.01%) ⬇️
application-template-api-modules 27.82% <ø> (+0.02%) ⬆️
application-templates-accident-notification 28.93% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 25.78% <ø> (ø)
application-templates-driving-license 18.12% <ø> (ø)
application-templates-estate 13.83% <ø> (ø)
application-templates-example-payment 24.71% <ø> (ø)
application-templates-financial-aid 14.42% <ø> (ø)
application-templates-general-petition 23.13% <ø> (ø)
application-templates-inheritance-report 6.54% <ø> (ø)
application-templates-marriage-conditions 15.11% <ø> (ø)
application-templates-mortgage-certificate 43.56% <ø> (ø)
application-templates-parental-leave 29.95% <ø> (ø)
application-types 6.57% <ø> (ø)
application-ui-components 1.24% <ø> (ø)
application-ui-shell 22.46% <ø> (ø)
clients-charge-fjs-v2 28.35% <ø> (ø)
judicial-system-web 27.91% <0.00%> (-0.01%) ⬇️
web 2.43% <ø> (ø)

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

Files with missing lines Coverage Δ
...-system/web/src/routes/Shared/Cases/MobileCase.tsx 9.52% <0.00%> (-1.01%) ⬇️

... and 49 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 fe1b1eb...3a2b39e. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Nov 28, 2024

Datadog Report

All test runs 05141d3 🔗

23 Total Test Services: 0 Failed, 22 Passed
➡️ Test Sessions change in coverage: 94 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
air-discount-scheme-web 0 0 0 2 0 8.72s 1 no change Link
api 0 0 0 4 0 2.72s 1 no change Link
api-domains-education 0 0 0 8 0 20.87s 1 no change Link
application-api-files 0 0 0 2 0 5.08s 1 no change Link
application-core 0 0 0 97 0 19.38s 1 no change Link
application-system-api 0 0 0 46 0 2m 26.06s 1 no change Link
application-template-api-modules 0 0 0 118 0 2m 30.65s 1 no change Link
application-templates-accident-notification 0 0 0 148 0 15.34s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 9.89s 1 no change Link
application-templates-driving-license 0 0 0 13 0 13.3s 1 no change Link

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 (1)
apps/judicial-system/web/src/routes/Shared/Cases/MobileCase.tsx (1)

73-73: Add type safety for the court property

While the optional chaining handles undefined cases well, consider adding proper TypeScript types for the court property in the CaseListEntry interface to ensure type safety.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between b2b82b4 and b8a41b6.

📒 Files selected for processing (1)
  • apps/judicial-system/web/src/routes/Shared/Cases/MobileCase.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
apps/judicial-system/web/src/routes/Shared/Cases/MobileCase.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."
🔇 Additional comments (1)
apps/judicial-system/web/src/routes/Shared/Cases/MobileCase.tsx (1)

10-10: LGTM: Import addition is well-placed

The new import is correctly grouped with other formatter utilities.

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.

Very nice. Just one question.

@oddsson oddsson added the automerge Merge this PR as soon as all checks pass label Dec 5, 2024
@kodiakhq kodiakhq bot removed the automerge Merge this PR as soon as all checks pass label Dec 5, 2024
Copy link
Contributor

kodiakhq bot commented Dec 5, 2024

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

@oddsson oddsson changed the title feat(j-s): Show district court abbreviation for public prosecutor feat(j-s): Show district court abbreviation for public prosecutor on mobile Dec 6, 2024
@oddsson oddsson changed the title feat(j-s): Show district court abbreviation for public prosecutor on mobile feat(j-s): Show district court abbreviation on mobile Dec 6, 2024
@oddsson oddsson added the automerge Merge this PR as soon as all checks pass label Dec 6, 2024
@kodiakhq kodiakhq bot merged commit beb3272 into main Dec 6, 2024
92 checks passed
@kodiakhq kodiakhq bot deleted the j-s/court-abbr branch December 6, 2024 18:59
thorhildurt pushed a commit that referenced this pull request Dec 11, 2024
* Add court abbr to getAllCases call

* Refactoring

* Refactoring

* Refactoring

* Refactoring

* Add abbr to mobile as well

* >merge

---------

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