Bug fix/standardize status texts#256
Conversation
…cy in AuditLogView
…t UI translations
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 54 minutes and 25 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR standardizes Swedish display labels for statuses and actions across backend and frontend: backend enum now holds Swedish labels; frontend uses new helper mappings and functions (including action labels) and updates UI text and status dropdown rendering accordingly. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/main/java/org/example/vet1177/services/MedicalRecordService.java (1)
245-259:⚠️ Potential issue | 🟡 MinorMinor: inconsistent log text between
updateStatus(CLOSED)andclose().Both paths emit an
ActivityType.STATUS_CHANGEDentry when a case ends up closed, but they produce different messages:
updateStatus(..., RecordStatus.CLOSED, ...)→"Status ändrad till: Avslutad"(line 256)close(...)→"Ärende stängt"(line 286)For users reading "Logg & Historik", the same business event will render with two different phrasings depending on which endpoint the client happened to call. Worth unifying so the activity log is deterministic regardless of code path.
♻️ Suggested alignment (one option)
activityLogService.log( ActivityType.STATUS_CHANGED, - "Ärende stängt", + "Status ändrad till: " + RecordStatus.CLOSED.displayLabel(), closedBy, updated );Alternatively, have
close()delegate toupdateStatus(..., CLOSED, ...)so there is a single source of truth for both the state transition and the log text.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/java/org/example/vet1177/services/MedicalRecordService.java` around lines 245 - 259, The activity log messages for the same business event are inconsistent between updateStatus(..., RecordStatus.CLOSED, ...) and close(...): unify them by choosing one canonical message or delegating close(...) to call updateStatus(...) so the same ActivityType.STATUS_CHANGED entry and text are used; update the call to activityLogService.log(...) (ActivityType.STATUS_CHANGED) to use the agreed Swedish label (e.g., "Status ändrad till: " + RecordStatus.CLOSED.displayLabel() or "Ärende stängt") and remove the duplicate/contradictory message in the other method so both paths produce identical log text.
🧹 Nitpick comments (1)
src/test/java/org/example/vet1177/services/MedicalRecordServiceTest.java (1)
432-437: LGTM – test now tracks the enum as the source of truth.Switching from a hardcoded
"AWAITING_INFO"substring toRecordStatus.AWAITING_INFO.displayLabel()is the right call: the test stays green automatically if the Swedish label is ever reworded, and it actually verifies the user-visible contract rather than the enum identifier.Optional (nit):
contains(...)on the label alone will still pass if the prefix"Status ändrad till: "is accidentally dropped or changed. If you want to lock the full log format, considereq("Status ändrad till: " + RecordStatus.AWAITING_INFO.displayLabel()). Not blocking.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/test/java/org/example/vet1177/services/MedicalRecordServiceTest.java` around lines 432 - 437, Tests now assert the enum's display label but to lock the full log format change the verifier to assert the exact message: in the verify(activityLogService).log(...) call replace the contains(RecordStatus.AWAITING_INFO.displayLabel()) argument with eq("Status ändrad till: " + RecordStatus.AWAITING_INFO.displayLabel()) so ActivityType.STATUS_CHANGED, the exact user-facing string, currentUser and record are all checked.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@frontend/src/components/admin/AuditLogView.jsx`:
- Around line 73-84: Remove the orphaned JSX block that appears between the
useMemo closure and the loading guard (the fragment referencing log, date, and
getActionLabel outside the render); then update the actual render loop where
each audit row is output (replace occurrences of log.action.replace('_', ' ')
with a call to getActionLabel(log.action) and ensure the existing loading check
(if (loading) return ...) remains at the top of the component return path);
verify there are no remaining references to the orphaned variables (log, date)
outside the loop and that getActionLabel is used inside the rendered map/loop
for headings.
In `@frontend/src/pages/CaseDetail.jsx`:
- Around line 3-6: There are duplicate imports for STATUS_MAP/ACTIVE_STATUS_KEYS
and lucide-react icons, and the new lucide import omitted UserMinus which is
still used; remove the duplicated import lines and consolidate into a single
import from '../utils/statusHelper' that includes STATUS_MAP and
ACTIVE_STATUS_KEYS, and a single import from 'lucide-react' that lists all icons
used (Stethoscope, Lock, FileText, CheckCircle, Upload, Trash2, ExternalLink,
UserMinus) so no bindings are redeclared and UserMinus remains defined.
In `@frontend/src/utils/statusHelper.js`:
- Around line 25-31: ACTION_LABELS is missing the UNASSIGNED key so AuditLogView
will display the raw "UNASSIGNED" string; add an entry 'UNASSIGNED': 'Släpp
ärende' (or the agreed Swedish label) to the ACTION_LABELS object so
getActionLabel(log.action) returns a localized heading instead of the raw enum;
update the ACTION_LABELS export accordingly.
---
Outside diff comments:
In `@src/main/java/org/example/vet1177/services/MedicalRecordService.java`:
- Around line 245-259: The activity log messages for the same business event are
inconsistent between updateStatus(..., RecordStatus.CLOSED, ...) and close(...):
unify them by choosing one canonical message or delegating close(...) to call
updateStatus(...) so the same ActivityType.STATUS_CHANGED entry and text are
used; update the call to activityLogService.log(...)
(ActivityType.STATUS_CHANGED) to use the agreed Swedish label (e.g., "Status
ändrad till: " + RecordStatus.CLOSED.displayLabel() or "Ärende stängt") and
remove the duplicate/contradictory message in the other method so both paths
produce identical log text.
---
Nitpick comments:
In `@src/test/java/org/example/vet1177/services/MedicalRecordServiceTest.java`:
- Around line 432-437: Tests now assert the enum's display label but to lock the
full log format change the verifier to assert the exact message: in the
verify(activityLogService).log(...) call replace the
contains(RecordStatus.AWAITING_INFO.displayLabel()) argument with eq("Status
ändrad till: " + RecordStatus.AWAITING_INFO.displayLabel()) so
ActivityType.STATUS_CHANGED, the exact user-facing string, currentUser and
record are all checked.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a21cda88-13c0-40a4-9358-511e974189d7
📒 Files selected for processing (7)
frontend/src/components/admin/AuditLogView.jsxfrontend/src/pages/AdminDashboard.jsxfrontend/src/pages/CaseDetail.jsxfrontend/src/utils/statusHelper.jssrc/main/java/org/example/vet1177/entities/RecordStatus.javasrc/main/java/org/example/vet1177/services/MedicalRecordService.javasrc/test/java/org/example/vet1177/services/MedicalRecordServiceTest.java
Standardiserar statustexter över hela gränssnittet och fixar två mindre textbuggar i admin-vyn. Tidigare visade ärendetiteln, status-dropdownen och
aktivitetsloggen olika ord för samma status (Inskickat / Öppen / IN_PROGRESS). Nu kommer alla texter från en enda mappning både i frontend och backend.
Ändringar
Statustexter — ny master-mappning
Backend
till activity_log-tabellen, så att lograderna lagras på svenska istället för raw enum.
Frontend
synk.
tillagd", "Veterinär tilldelad", "Ärende uppdaterat" istället för STATUS CHANGED m.fl.
Övriga UI-textfixar
AdminDashboard.jsx
Påverkan på användaren
"Avslutad").
closes #239
closes #249
Summary by CodeRabbit
Bug Fixes
New Features
Localization