-
Notifications
You must be signed in to change notification settings - Fork 61
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): Display defendant appealed verdict tag for public prosecutor #17303
Conversation
WalkthroughThis pull request introduces updates to the judicial system web application's case review functionality. Key changes include adding a new internationalization message for indicating when a defendant has appealed a verdict, implementing a new GraphQL field for retrieving the appeal date for defendants, and modifying the Changes
Sequence DiagramsequenceDiagram
participant GraphQL as GraphQL Service
participant Component as CasesReviewed Component
participant UI as User Interface
GraphQL->>Component: Fetch cases with verdictAppealDate
Component->>Component: Check defendant appeal status
Component->>UI: Render case list with appeal tags
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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
🧹 Nitpick comments (2)
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx (2)
85-89
: Add unit tests for the hasDefendantAppealedVerdict functionThe helper function is well-implemented with proper null checks and type safety. However, it would benefit from unit tests to verify edge cases.
Would you like me to help generate unit tests for this function? The tests should cover:
- Empty defendants array
- Null defendants
- Mixed cases with some defendants having appeal dates
- No defendants having appeal dates
156-174
: Consider improving tag visual hierarchyThe implementation correctly displays the appeal tag, but consider adjusting the visual hierarchy:
- The appeal tag might be more logically placed before the review decision tag since it represents a status change
- Both tags could be wrapped in a single Box for consistent spacing
Consider this alternative structure:
- <> - <Box marginRight={1}> - <Tag variant="darkerBlue" outlined disabled truncate> - {row.indictmentReviewDecision && - indictmentReviewDecisionMapping( - row.indictmentReviewDecision, - row.indictmentRulingDecision === - CaseIndictmentRulingDecision.FINE, - )} - </Tag> - </Box> - {hasDefendantAppealedVerdict(row.defendants) && ( - <Box marginTop={1}> - <Tag variant="red" outlined disabled truncate> - {formatMessage(strings.tagDefendantAppealedVerdict)} - </Tag> - </Box> - )} - </> + <Box display="flex" flexDirection="column" gap={1}> + {hasDefendantAppealedVerdict(row.defendants) && ( + <Tag variant="red" outlined disabled truncate> + {formatMessage(strings.tagDefendantAppealedVerdict)} + </Tag> + )} + <Tag variant="darkerBlue" outlined disabled truncate> + {row.indictmentReviewDecision && + indictmentReviewDecisionMapping( + row.indictmentReviewDecision, + row.indictmentRulingDecision === + CaseIndictmentRulingDecision.FINE, + )} + </Tag> + </Box>
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.strings.ts
(1 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)
🧰 Additional context used
📓 Path-based instructions (3)
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."
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/PublicProsecutor/Tables/CasesReviewed.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."
📓 Learnings (1)
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 (3)
apps/judicial-system/web/src/routes/Shared/Cases/cases.graphql (1)
31-31
: LGTM! Verify GraphQL schema compatibility
The addition of the verdictAppealDate
field to the defendants object is well-placed and follows GraphQL naming conventions.
Let's verify the GraphQL schema compatibility:
✅ Verification successful
LGTM - Field is properly defined in the schema
The verdictAppealDate
field is properly defined in the backend models and DTOs:
- It exists as an optional Date field in the Defendant model (
apps/judicial-system/backend/src/app/modules/defendant/models/defendant.model.ts
) - It's included in the update DTO (
apps/judicial-system/backend/src/app/modules/defendant/dto/updateDefendant.dto.ts
) - The field is used consistently across the frontend components for displaying and handling appeal dates
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Check for any GraphQL schema validation errors and field usage
# Search for GraphQL type definitions containing verdictAppealDate
rg -A 5 "type.*Defendant.*{|input.*Defendant.*{"
# Search for other usages of verdictAppealDate field
rg "verdictAppealDate"
Length of output: 2331
Script:
#!/bin/bash
# Let's fix the regex and search for GraphQL type definitions
rg -A 5 "type\s+Defendant\s*{|input\s+Defendant\s*{"
# Let's also check the GraphQL schema files specifically
fd ".graphql$" --exec cat {}
Length of output: 67559
Script:
#!/bin/bash
# Let's search for Defendant type definition in TypeScript files since GraphQL schema might be generated from them
rg -A 10 "class\s+Defendant|interface\s+Defendant|type\s+Defendant" --type ts
# Also search for verdictAppealDate in TypeScript model/type definitions
rg "verdictAppealDate.*:.*Date" --type ts
Length of output: 17573
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.strings.ts (1)
63-68
: LGTM! String definition follows established patterns
The new message definition for the defendant appeal tag follows the existing conventions for tag messages, with appropriate ID structure and clear description.
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx (1)
5-5
: LGTM! Import statement is properly organized
The Box component import is appropriately added to the existing island-ui/core imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, tested and works well. Just left tiny nits but will approve 👍
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx
Outdated
Show resolved
Hide resolved
apps/judicial-system/web/src/routes/PublicProsecutor/Tables/CasesReviewed.tsx
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #17303 +/- ##
==========================================
+ Coverage 35.65% 35.67% +0.02%
==========================================
Files 6939 6936 -3
Lines 149120 149007 -113
Branches 42638 42578 -60
==========================================
- Hits 53164 53159 -5
+ Misses 95956 95848 -108
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 10 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Datadog ReportBranch report: ✅ 0 Failed, 336 Passed, 0 Skipped, 57.22s Total Time |
This PR currently has a merge conflict. Please resolve this and then re-add the |
Asana
What
Display a tag if a defendant appealed the verdict in an indictment case on the public prosecutors office cases page.
Why
So that the public prosecutors office can easily see whether or not the defendant appealed the verdict.
Checklist:
Summary by CodeRabbit
New Features
Bug Fixes