From 1e52ca9e43cdd1b9ae7d0547d78a9c41455b9bf2 Mon Sep 17 00:00:00 2001 From: Daniel Haselhan Date: Wed, 18 Dec 2024 10:39:52 -0800 Subject: [PATCH] Code Review Feedback * Rename ComplianceReportViewSelector --- backend/lcfs/services/rabbitmq/report_consumer.py | 3 +++ frontend/src/App.jsx | 4 ++-- ...Brancher.jsx => ComplianceReportViewSelector.jsx} | 2 +- ...est.jsx => ComplianceReportViewSelector.test.jsx} | 12 ++++++------ 4 files changed, 12 insertions(+), 9 deletions(-) rename frontend/src/views/ComplianceReports/{ViewComplianceReportBrancher.jsx => ComplianceReportViewSelector.jsx} (95%) rename frontend/src/views/ComplianceReports/__tests__/{ViewComplianceReportBrancher.test.jsx => ComplianceReportViewSelector.test.jsx} (90%) diff --git a/backend/lcfs/services/rabbitmq/report_consumer.py b/backend/lcfs/services/rabbitmq/report_consumer.py index f03df28ee..551f3781b 100644 --- a/backend/lcfs/services/rabbitmq/report_consumer.py +++ b/backend/lcfs/services/rabbitmq/report_consumer.py @@ -156,6 +156,9 @@ async def handle_message( ) user = await UserRepository(db=session).get_user_by_id(user_id) + if not user: + logger.error(f"Cannot parse Report {legacy_id} from TFRS, no user with ID {user_id}") + if action == "Created": await self._handle_created( org_id, diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 907ce057a..27d484513 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -36,7 +36,7 @@ import { AddEditAllocationAgreements } from './views/AllocationAgreements/AddEdi import { logout } from '@/utils/keycloak.js' import { CompareReports } from '@/views/CompareReports/CompareReports' import { ViewLegacyComplianceReport } from '@/views/ComplianceReports/ViewLegacyComplianceReport.jsx' -import { ViewComplianceReportBrancher } from '@/views/ComplianceReports/ViewComplianceReportBrancher.jsx' +import { ComplianceReportViewSelector } from '@/views/ComplianceReports/ComplianceReportViewSelector.jsx' const router = createBrowserRouter([ { @@ -198,7 +198,7 @@ const router = createBrowserRouter([ }, { path: ROUTES.REPORTS_VIEW, - element: , + element: , handle: { title: '' } }, { diff --git a/frontend/src/views/ComplianceReports/ViewComplianceReportBrancher.jsx b/frontend/src/views/ComplianceReports/ComplianceReportViewSelector.jsx similarity index 95% rename from frontend/src/views/ComplianceReports/ViewComplianceReportBrancher.jsx rename to frontend/src/views/ComplianceReports/ComplianceReportViewSelector.jsx index de4b97f75..04cb92111 100644 --- a/frontend/src/views/ComplianceReports/ViewComplianceReportBrancher.jsx +++ b/frontend/src/views/ComplianceReports/ComplianceReportViewSelector.jsx @@ -5,7 +5,7 @@ import { ViewLegacyComplianceReport } from '@/views/ComplianceReports/ViewLegacy import { useParams } from 'react-router-dom' import { EditViewComplianceReport } from '@/views/ComplianceReports/EditViewComplianceReport.jsx' -export const ViewComplianceReportBrancher = () => { +export const ComplianceReportViewSelector = () => { const { complianceReportId } = useParams() const { data: currentUser, isLoading: isCurrentUserLoading } = useCurrentUser() diff --git a/frontend/src/views/ComplianceReports/__tests__/ViewComplianceReportBrancher.test.jsx b/frontend/src/views/ComplianceReports/__tests__/ComplianceReportViewSelector.test.jsx similarity index 90% rename from frontend/src/views/ComplianceReports/__tests__/ViewComplianceReportBrancher.test.jsx rename to frontend/src/views/ComplianceReports/__tests__/ComplianceReportViewSelector.test.jsx index 0b3127534..4ceada497 100644 --- a/frontend/src/views/ComplianceReports/__tests__/ViewComplianceReportBrancher.test.jsx +++ b/frontend/src/views/ComplianceReports/__tests__/ComplianceReportViewSelector.test.jsx @@ -1,7 +1,7 @@ import React from 'react' import { render, screen, waitFor } from '@testing-library/react' import { describe, it, expect, beforeEach, vi } from 'vitest' -import { ViewComplianceReportBrancher } from '../ViewComplianceReportBrancher' +import { ComplianceReportViewSelector } from '../ComplianceReportViewSelector.jsx' import * as useComplianceReportsHook from '@/hooks/useComplianceReports' import * as useCurrentUserHook from '@/hooks/useCurrentUser' import { wrapper } from '@/tests/utils/wrapper' @@ -71,7 +71,7 @@ describe('ViewComplianceReportBrancher', () => { it('renders loading when user is loading', async () => { setupMocks({ isCurrentUserLoading: true }) - render(, { wrapper }) + render(, { wrapper }) await waitFor(() => { expect(screen.getByText('Loading...')).toBeInTheDocument() @@ -80,7 +80,7 @@ describe('ViewComplianceReportBrancher', () => { it('renders loading when report is loading', async () => { setupMocks({ isReportLoading: true }) - render(, { wrapper }) + render(, { wrapper }) await waitFor(() => { expect(screen.getByText('Loading...')).toBeInTheDocument() @@ -97,7 +97,7 @@ describe('ViewComplianceReportBrancher', () => { } }) - render(, { wrapper }) + render(, { wrapper }) await waitFor(() => { expect(screen.getByText('Legacy Report View')).toBeInTheDocument() @@ -117,7 +117,7 @@ describe('ViewComplianceReportBrancher', () => { } }) - render(, { wrapper }) + render(, { wrapper }) await waitFor(() => { expect(screen.getByText('Edit Compliance Report')).toBeInTheDocument() @@ -137,7 +137,7 @@ describe('ViewComplianceReportBrancher', () => { } }) - render(, { wrapper }) + render(, { wrapper }) await waitFor(() => { expect(screen.getByText('Edit Compliance Report')).toBeInTheDocument()