From 1443faa65726a107018a1fea1e682fc56fad2c13 Mon Sep 17 00:00:00 2001 From: Nechama Krigsman Date: Tue, 26 Nov 2024 10:43:31 -0500 Subject: [PATCH 01/10] 10489: generate freeText for default docket entry descriptions; set eventCode to OJR when stricken from trial and jurisdiction is retained; --- .../fileCourtIssuedOrderInteractor.test.ts | 366 ++++++++++++++++-- .../fileCourtIssuedOrderInteractor.ts | 81 +++- 2 files changed, 407 insertions(+), 40 deletions(-) diff --git a/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts b/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts index c83d9a05950..0543eca983c 100644 --- a/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts +++ b/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts @@ -21,6 +21,7 @@ import { } from '@shared/test/mockAuthUsers'; import { updateMessage } from '@web-api/persistence/postgres/messages/updateMessage'; +/* eslint-disable max-lines */ describe('fileCourtIssuedOrderInteractor', () => { const mockUserId = applicationContext.getUniqueId(); const caseRecord = { @@ -146,41 +147,6 @@ describe('fileCourtIssuedOrderInteractor', () => { ).toEqual(4); }); - it('should add order document to case and set freeText and draftOrderState.freeText to the document title if it is a generic order (eventCode O)', async () => { - await fileCourtIssuedOrderInteractor( - applicationContext, - { - documentMetadata: { - docketNumber: caseRecord.docketNumber, - documentTitle: 'Order to do anything', - documentType: 'Order', - draftOrderState: {}, - eventCode: 'O', - signedAt: '2019-03-01T21:40:46.415Z', - signedByUserId: mockUserId, - signedJudgeName: 'Dredd', - }, - primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', - }, - mockDocketClerkUser, - ); - - expect( - applicationContext.getPersistenceGateway().getCaseByDocketNumber, - ).toHaveBeenCalled(); - expect( - applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] - .caseToUpdate.docketEntries.length, - ).toEqual(4); - expect( - applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] - .caseToUpdate.docketEntries[3], - ).toMatchObject({ - draftOrderState: { freeText: 'Order to do anything' }, - freeText: 'Order to do anything', - }); - }); - it('should delete draftOrderState properties if they exists on the documentMetadata, after saving the document', async () => { await fileCourtIssuedOrderInteractor( applicationContext, @@ -507,4 +473,334 @@ describe('fileCourtIssuedOrderInteractor', () => { identifiers: [`case|${caseRecord.docketNumber}`], }); }); + + describe('freeText', () => { + describe('eventCode "NOT"', () => { + it('should add order document to case and set freeText and draftOrderState.freeText to the document title if it eventCode NOT', async () => { + await fileCourtIssuedOrderInteractor( + applicationContext, + { + documentMetadata: { + docketNumber: caseRecord.docketNumber, + documentTitle: 'Order to do anything', + documentType: 'Order', + draftOrderState: {}, + eventCode: 'NOT', + signedAt: '2019-03-01T21:40:46.415Z', + signedByUserId: mockUserId, + signedJudgeName: 'Dredd', + }, + primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', + }, + mockDocketClerkUser, + ); + + expect( + applicationContext.getPersistenceGateway().getCaseByDocketNumber, + ).toHaveBeenCalled(); + expect( + applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] + .caseToUpdate.docketEntries.length, + ).toEqual(4); + expect( + applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] + .caseToUpdate.docketEntries[3], + ).toMatchObject({ + draftOrderState: { freeText: 'Order to do anything' }, + freeText: 'Order to do anything', + }); + }); + }); + + describe('eventCode "O"', () => { + it('should add order document to case and set freeText and draftOrderState.freeText correctly for orderType status report', async () => { + await fileCourtIssuedOrderInteractor( + applicationContext, + { + documentMetadata: { + draftOrderState: {}, + dueDate: '2024-11-05', + eventCode: 'O', + orderType: 'statusReport', + strickenFromTrialSessions: false, + }, + primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', + }, + mockDocketClerkUser, + ); + + expect( + applicationContext.getPersistenceGateway().getCaseByDocketNumber, + ).toHaveBeenCalled(); + expect( + applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] + .caseToUpdate.docketEntries[3], + ).toMatchObject({ + draftOrderState: { + freeText: 'Order parties by 11/05/2024 shall file a status report.', + }, + freeText: 'Order parties by 11/05/2024 shall file a status report.', + }); + }); + + it('should add order document to case and set freeText and draftOrderState.freeText correctly for orderType status report and when case is stricken from current trial session', async () => { + await fileCourtIssuedOrderInteractor( + applicationContext, + { + documentMetadata: { + draftOrderState: {}, + dueDate: '2024-11-05', + eventCode: 'O', + orderType: 'statusReport', + strickenFromTrialSessions: true, + }, + primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', + }, + mockDocketClerkUser, + ); + + expect( + applicationContext.getPersistenceGateway().getCaseByDocketNumber, + ).toHaveBeenCalled(); + expect( + applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] + .caseToUpdate.docketEntries[3], + ).toMatchObject({ + draftOrderState: { + freeText: + 'Order parties by 11/05/2024 shall file a status report. Case is stricken from the current trial session.', + }, + freeText: + 'Order parties by 11/05/2024 shall file a status report. Case is stricken from the current trial session.', + }); + }); + + it('should add order document to case and set freeText and draftOrderState.freeText correctly for orderType status report and when case is stricken from current trial session and jurisdiction is restored to general docket', async () => { + await fileCourtIssuedOrderInteractor( + applicationContext, + { + documentMetadata: { + draftOrderState: {}, + dueDate: '2024-11-05', + eventCode: 'O', + jurisdiction: 'restoredToGeneralDocket', + orderType: 'statusReport', + strickenFromTrialSessions: true, + }, + primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', + }, + mockDocketClerkUser, + ); + + expect( + applicationContext.getPersistenceGateway().getCaseByDocketNumber, + ).toHaveBeenCalled(); + expect( + applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] + .caseToUpdate.docketEntries[3], + ).toMatchObject({ + draftOrderState: { + freeText: + 'Order parties by 11/05/2024 shall file a status report. Case is stricken from the current trial session. Case is no longer jurisdiction retained and is restored to the general docket.', + }, + freeText: + 'Order parties by 11/05/2024 shall file a status report. Case is stricken from the current trial session. Case is no longer jurisdiction retained and is restored to the general docket.', + }); + }); + + it('should add order document to case and set freeText and draftOrderState.freeText correctly for orderType status report stipulated decision', async () => { + await fileCourtIssuedOrderInteractor( + applicationContext, + { + documentMetadata: { + draftOrderState: {}, + dueDate: '2024-11-05', + eventCode: 'O', + orderType: 'statusReportStipulatedDecision', + strickenFromTrialSessions: false, + }, + primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', + }, + mockDocketClerkUser, + ); + + expect( + applicationContext.getPersistenceGateway().getCaseByDocketNumber, + ).toHaveBeenCalled(); + expect( + applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] + .caseToUpdate.docketEntries[3], + ).toMatchObject({ + draftOrderState: { + freeText: + 'Order parties by 11/05/2024 shall file a status report or proposed stipulated decision.', + }, + freeText: + 'Order parties by 11/05/2024 shall file a status report or proposed stipulated decision.', + }); + }); + + it('should add order document to case and set freeText and draftOrderState.freeText correctly for orderType status report stipulated decision and when case is stricken from current trial session', async () => { + await fileCourtIssuedOrderInteractor( + applicationContext, + { + documentMetadata: { + draftOrderState: {}, + dueDate: '2024-11-05', + eventCode: 'O', + orderType: 'statusReportStipulatedDecision', + strickenFromTrialSessions: true, + }, + primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', + }, + mockDocketClerkUser, + ); + + expect( + applicationContext.getPersistenceGateway().getCaseByDocketNumber, + ).toHaveBeenCalled(); + expect( + applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] + .caseToUpdate.docketEntries[3], + ).toMatchObject({ + draftOrderState: { + freeText: + 'Order parties by 11/05/2024 shall file a status report or proposed stipulated decision. Case is stricken from the current trial session.', + }, + freeText: + 'Order parties by 11/05/2024 shall file a status report or proposed stipulated decision. Case is stricken from the current trial session.', + }); + }); + + it('should add order document to case and set freeText and draftOrderState.freeText correctly for orderType status report stipulated decision and when case is stricken from current trial session and jurisdiction is restored to general docket', async () => { + await fileCourtIssuedOrderInteractor( + applicationContext, + { + documentMetadata: { + draftOrderState: {}, + dueDate: '2024-11-05', + eventCode: 'O', + jurisdiction: 'restoredToGeneralDocket', + orderType: 'statusReportStipulatedDecision', + strickenFromTrialSessions: true, + }, + primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', + }, + mockDocketClerkUser, + ); + + expect( + applicationContext.getPersistenceGateway().getCaseByDocketNumber, + ).toHaveBeenCalled(); + expect( + applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] + .caseToUpdate.docketEntries[3], + ).toMatchObject({ + draftOrderState: { + freeText: + 'Order parties by 11/05/2024 shall file a status report or proposed stipulated decision. Case is stricken from the current trial session. Case is no longer jurisdiction retained and is restored to the general docket.', + }, + freeText: + 'Order parties by 11/05/2024 shall file a status report or proposed stipulated decision. Case is stricken from the current trial session. Case is no longer jurisdiction retained and is restored to the general docket.', + }); + }); + }); + + describe('eventcode "OJR"', () => { + it('should add order document to case and set freeText and draftOrderState.freeText correctly when order type is statusReport', async () => { + await fileCourtIssuedOrderInteractor( + applicationContext, + { + documentMetadata: { + docketNumber: caseRecord.docketNumber, + draftOrderState: {}, + dueDate: '2024-11-05', + eventCode: 'O', + jurisdiction: 'retained', + orderType: 'statusReport', + strickenFromTrialSessions: true, + }, + primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', + }, + mockDocketClerkUser, + ); + expect( + applicationContext.getPersistenceGateway().getCaseByDocketNumber, + ).toHaveBeenCalled(); + expect( + applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] + .caseToUpdate.docketEntries[3], + ).toMatchObject({ + draftOrderState: { + freeText: + '. Parties by 11/05/2024 shall file a status report. Case is stricken from the current trial session.', + }, + freeText: + '. Parties by 11/05/2024 shall file a status report. Case is stricken from the current trial session.', + }); + }); + + it('should add order document to case and set freeText and draftOrderState.freeText correctly when order type is statusReportStipulatedDecision and case is stricken from the current trial session', async () => { + await fileCourtIssuedOrderInteractor( + applicationContext, + { + documentMetadata: { + docketNumber: caseRecord.docketNumber, + draftOrderState: {}, + dueDate: '2024-11-05', + eventCode: 'O', + jurisdiction: 'retained', + orderType: 'statusReportStipulatedDecision', + strickenFromTrialSessions: true, + }, + primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', + }, + mockDocketClerkUser, + ); + expect( + applicationContext.getPersistenceGateway().getCaseByDocketNumber, + ).toHaveBeenCalled(); + expect( + applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] + .caseToUpdate.docketEntries[3], + ).toMatchObject({ + draftOrderState: { + freeText: + '. Parties by 11/05/2024 shall file a status report or proposed stipulated decision. Case is stricken from the current trial session.', + }, + freeText: + '. Parties by 11/05/2024 shall file a status report or proposed stipulated decision. Case is stricken from the current trial session.', + }); + }); + + it('should add order document to case and set freeText and draftOrderState.freeText correctly when case is stricken from the current trial session', async () => { + await fileCourtIssuedOrderInteractor( + applicationContext, + { + documentMetadata: { + docketNumber: caseRecord.docketNumber, + draftOrderState: {}, + eventCode: 'O', + jurisdiction: 'retained', + strickenFromTrialSessions: true, + }, + primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', + }, + mockDocketClerkUser, + ); + expect( + applicationContext.getPersistenceGateway().getCaseByDocketNumber, + ).toHaveBeenCalled(); + expect( + applicationContext.getPersistenceGateway().updateCase.mock.calls[0][0] + .caseToUpdate.docketEntries[3], + ).toMatchObject({ + draftOrderState: { + freeText: '. Case is stricken from the current trial session.', + }, + freeText: '. Case is stricken from the current trial session.', + }); + }); + }); + }); }); diff --git a/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.ts b/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.ts index b7402b20a36..796a0381cb4 100644 --- a/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.ts +++ b/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.ts @@ -1,6 +1,13 @@ +import { + COURT_ISSUED_EVENT_CODES, + DOCUMENT_RELATIONSHIPS, +} from '../../../../../shared/src/business/entities/EntityConstants'; import { Case } from '../../../../../shared/src/business/entities/cases/Case'; -import { DOCUMENT_RELATIONSHIPS } from '../../../../../shared/src/business/entities/EntityConstants'; import { DocketEntry } from '../../../../../shared/src/business/entities/DocketEntry'; +import { + FORMATS, + formatDateString, +} from '@shared/business/utilities/DateHandler'; import { Message } from '../../../../../shared/src/business/entities/Message'; import { ROLE_PERMISSIONS, @@ -40,11 +47,22 @@ export const fileCourtIssuedOrder = async ( }); const caseEntity = new Case(caseToUpdate, { authorizedUser }); - if (['O', 'NOT'].includes(documentMetadata.eventCode)) { - documentMetadata.freeText = documentMetadata.documentTitle; + if ( + documentMetadata.strickenFromTrialSessions && + documentMetadata.jurisdiction === 'retained' + ) { + const ojrEventCode = COURT_ISSUED_EVENT_CODES.find( + e => e.eventCode === 'OJR', + ); + documentMetadata.documentType = ojrEventCode?.documentType; + documentMetadata.eventCode = 'OJR'; + } + + if (['O', 'NOT', 'OJR'].includes(documentMetadata.eventCode)) { + const freeText = generateFreeText(documentMetadata); + documentMetadata.freeText = freeText; if (documentMetadata.draftOrderState) { - documentMetadata.draftOrderState.freeText = - documentMetadata.documentTitle; + documentMetadata.draftOrderState.freeText = freeText; } } @@ -138,3 +156,56 @@ export const fileCourtIssuedOrderInteractor = withLocking( identifiers: [`case|${documentMetadata.docketNumber}`], }), ); + +function generateFreeText(documentMetadata: { + orderType: string; + documentTitle: string; + dueDate: string; + eventCode: string; + strickenFromTrialSessions: boolean; + jurisdiction: string; +}) { + const { + documentTitle, + dueDate, + eventCode, + jurisdiction, + orderType, + strickenFromTrialSessions, + } = documentMetadata; + + const formattedDueDate = formatDateString(dueDate, FORMATS.MMDDYYYY); + if (eventCode === 'OJR') { + return [ + orderType === 'statusReport' && + `. Parties by ${formattedDueDate} shall file a status report.`, + orderType === 'statusReportStipulatedDecision' && + `. Parties by ${formattedDueDate} shall file a status report or proposed stipulated decision.`, + orderType !== 'statusReportStipulatedDecision' && + orderType !== 'statusReport' && + strickenFromTrialSessions && + '.', + strickenFromTrialSessions && + 'Case is stricken from the current trial session.', + ] + .filter(Boolean) + .join(' '); + } + + if (eventCode === 'O' && (orderType || jurisdiction)) { + return [ + 'Order', + orderType === 'statusReport' && + `parties by ${formattedDueDate} shall file a status report.`, + orderType === 'statusReportStipulatedDecision' && + `parties by ${formattedDueDate} shall file a status report or proposed stipulated decision.`, + strickenFromTrialSessions && + 'Case is stricken from the current trial session.', + jurisdiction === 'restoredToGeneralDocket' && + 'Case is no longer jurisdiction retained and is restored to the general docket.', + ] + .filter(Boolean) + .join(' '); + } + return documentTitle; +} From 47ed28073816aaba200ee96e14f4746c789f07fa Mon Sep 17 00:00:00 2001 From: Nechama Krigsman Date: Tue, 26 Nov 2024 10:44:39 -0500 Subject: [PATCH 02/10] 10489: fix extra space showing before the period on docket entry description; --- shared/src/business/utilities/replaceBracketed.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/shared/src/business/utilities/replaceBracketed.ts b/shared/src/business/utilities/replaceBracketed.ts index b7a3b0bfc9f..62d3899b3dc 100644 --- a/shared/src/business/utilities/replaceBracketed.ts +++ b/shared/src/business/utilities/replaceBracketed.ts @@ -6,6 +6,7 @@ export const replaceBracketed = ( while (bracketsMatcher.test(template)) { template = template.replace(bracketsMatcher, values.shift() || ''); } + template = template.replace(/\s+\./g, '.'); template = template.trim(); return template; }; From f766dcb23640220fa89f40cd18d3894292c5543d Mon Sep 17 00:00:00 2001 From: Nechama Krigsman Date: Tue, 26 Nov 2024 10:45:14 -0500 Subject: [PATCH 03/10] 10489: set default judge when eventCode is OJR; --- ...urtIssuedDocumentInitialDataAction.test.ts | 44 +++++++++++++++++++ ...setCourtIssuedDocumentInitialDataAction.ts | 11 +++++ 2 files changed, 55 insertions(+) diff --git a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts index 6d89a183086..98398ba3e31 100644 --- a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts +++ b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts @@ -8,6 +8,7 @@ describe('setCourtIssuedDocumentInitialDataAction', () => { const docketEntryIds = [ 'ddfd978d-6be6-4877-b004-2b5735a41fee', '11597d22-0874-4c5e-ac98-a843d1472baf', + '22597d22-0874-4c5e-ac98-a843d1472baf', ]; beforeAll(() => { @@ -22,6 +23,11 @@ describe('setCourtIssuedDocumentInitialDataAction', () => { eventCode: 'O', freeText: 'something', }); + MOCK_CASE.docketEntries.push({ + docketEntryId: docketEntryIds[2], + eventCode: 'OJR', + signedByUserId: '4497d22-0874-4c5e-ac98-a843d1472baf', + }); }); it('should set correct values on state.form for the docketEntryId passed in via props', async () => { @@ -108,4 +114,42 @@ describe('setCourtIssuedDocumentInitialDataAction', () => { expect(result.state.form).toEqual({}); }); + + it('should set the judge name when eventcode is OJR and docketEntry was signed by the judge', async () => { + const result = await runAction(setCourtIssuedDocumentInitialDataAction, { + modules: { + presenter, + }, + props: { + docketEntryId: '22597d22-0874-4c5e-ac98-a843d1472baf', + }, + state: { + caseDetail: MOCK_CASE, + form: {}, + judges: [ + { name: 'Colvin', userId: '4497d22-0874-4c5e-ac98-a843d1472baf' }, + ], + }, + }); + expect(result.state.form.judge).toEqual('Colvin'); + }); + + it('should not set the judge name when eventcode is OJR and docketEntry was signed by a non judge user', async () => { + const result = await runAction(setCourtIssuedDocumentInitialDataAction, { + modules: { + presenter, + }, + props: { + docketEntryId: '22597d22-0874-4c5e-ac98-a843d1472baf', + }, + state: { + caseDetail: MOCK_CASE, + form: {}, + judges: [ + { name: 'Cohen', userId: '3297d22-0874-4c5e-ac98-a843d1472baf' }, + ], + }, + }); + expect(result.state.form.judge).toEqual(undefined); + }); }); diff --git a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.ts b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.ts index a99dd05072c..0fbd5c9596a 100644 --- a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.ts +++ b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.ts @@ -18,6 +18,8 @@ export const setCourtIssuedDocumentInitialDataAction = ({ }: ActionProps) => { const { docketEntries } = get(state.caseDetail); + const judges = get(state.judges); + const docketEntry = docketEntries.find( item => item.docketEntryId === props.docketEntryId, ); @@ -34,6 +36,15 @@ export const setCourtIssuedDocumentInitialDataAction = ({ store.set(state.form.attachments, false); } + if (docketEntry.eventCode === 'OJR') { + const signingJudge = judges.find(judge => { + return judge.userId === docketEntry.signedByUserId; + }); + if (signingJudge) { + store.set(state.form.judge, signingJudge.name); + } + } + if (docketEntry.freeText) { store.set(state.form.freeText, docketEntry.freeText); } From 478463ae3a7c08616e8feb5ec183c929d81fb335 Mon Sep 17 00:00:00 2001 From: Nechama Krigsman Date: Tue, 26 Nov 2024 12:25:50 -0500 Subject: [PATCH 04/10] 10489: add cypress tests; --- ...atus-report-order-description-fields.cy.ts | 81 +++++++++++++++++++ .../CourtIssuedDocketEntry.tsx | 5 +- web-client/src/views/StatusReportOrder.tsx | 1 + 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts diff --git a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts new file mode 100644 index 00000000000..8063b6b6c20 --- /dev/null +++ b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts @@ -0,0 +1,81 @@ +import { + FORMATS, + formatNow, +} from '../../../../../shared/src/business/utilities/DateHandler'; +import { + docketNumber, + getLastDraftOrderElementFromDrafts, +} from '../../../support/statusReportOrder'; +import { + loginAsColvin, + loginAsDocketClerk, +} from '../../../../helpers/authentication/login-as-helpers'; +import { logout } from '../../../../helpers/authentication/logout'; + +describe('should default status report order descriptions', () => { + const today = formatNow(FORMATS.MMDDYYYY); + it('should display default description when document type is an Order', () => { + judgeCreatesAndSavesStatusReportOrder(today); + loginAsDocketClerk(); + cy.visit(`/case-detail/${docketNumber}`); + cy.get('#tab-drafts').click(); + getLastDraftOrderElementFromDrafts().click(); + cy.get('[data-testid="add-court-issued-docket-entry-button"]').click(); + cy.get('.select-react-element__control').should('have.text', 'Order'); + cy.get('[data-testid="document-description-input"]').should( + 'have.value', + `Order parties by ${today} shall file a status report.`, + ); + cy.get('[data-testid="docket-entry-preview-text"]').should( + 'have.text', + `Docket entry preview: Order parties by ${today} shall file a status report.`, + ); + }); + it('should set event code to OJR when case is stricken from trial session and jurisdiction is retained and display default description', () => { + judgeCreatesAndSavesStatusReportOrder(today, true); + loginAsDocketClerk(); + cy.visit(`/case-detail/${docketNumber}`); + cy.get('#tab-drafts').click(); + getLastDraftOrderElementFromDrafts().click(); + cy.get('[data-testid="add-court-issued-docket-entry-button"]').click(); + cy.get('.select-react-element__control').should( + 'have.text', + 'Order that jurisdiction is retained', + ); + cy.get('[data-testid="document-description-input"]').should( + 'have.value', + `. Parties by ${today} shall file a status report. Case is stricken from the current trial session.`, + ); + cy.get('#judge-label').click(); + cy.get('[data-testid="docket-entry-preview-text"]').should( + 'have.text', + `Docket entry preview: Order that jurisdiction is retained by Colvin. Parties by ${today} shall file a status report. Case is stricken from the current trial session.`, + ); + }); +}); + +function judgeCreatesAndSavesStatusReportOrder( + today: string, + jurisdictionRetain: boolean = false, +) { + loginAsColvin(); + cy.visit(`/case-detail/${docketNumber}`); + cy.get('#tab-document-view').click(); + cy.contains('Status Report').click(); + cy.get('[data-testid="status-report-order-button"]').click(); + cy.get('[data-testid="order-type-status-report"]').check({ force: true }); + cy.get('#status-report-due-date-picker').type(today); + + if (jurisdictionRetain) { + cy.get('#stricken-from-trial-sessions-label').click(); + + cy.get( + '#jurisdiction-form-group > :nth-child(2) > .usa-radio__label', + ).click(); + cy.get('#jurisdiction-retained').check(); + } + cy.get('[data-testid="save-draft-button"]').click(); + cy.get('[data-testid="sign-pdf-canvas"]').click(); + cy.get('[data-testid="save-signature-button"]').click(); + logout(); +} diff --git a/web-client/src/views/CourtIssuedDocketEntry/CourtIssuedDocketEntry.tsx b/web-client/src/views/CourtIssuedDocketEntry/CourtIssuedDocketEntry.tsx index a0130b97787..8a0bea98655 100644 --- a/web-client/src/views/CourtIssuedDocketEntry/CourtIssuedDocketEntry.tsx +++ b/web-client/src/views/CourtIssuedDocketEntry/CourtIssuedDocketEntry.tsx @@ -96,7 +96,10 @@ export const CourtIssuedDocketEntry = connect(
-
+
Docket entry preview: {addCourtIssuedDocketEntryHelper.formattedDocumentTitle}
diff --git a/web-client/src/views/StatusReportOrder.tsx b/web-client/src/views/StatusReportOrder.tsx index 09247c74aee..b1fc668d836 100644 --- a/web-client/src/views/StatusReportOrder.tsx +++ b/web-client/src/views/StatusReportOrder.tsx @@ -155,6 +155,7 @@ export const StatusReportOrder = connect( .statusReport } className="usa-radio__input" + data-testid="order-type-status-report" id="order-type-status-report" name="orderType" type="radio" From e1ee1f43289f455667b3d2a623c316fb4b7893d2 Mon Sep 17 00:00:00 2001 From: Nechama Krigsman Date: Tue, 26 Nov 2024 14:27:50 -0500 Subject: [PATCH 05/10] 10489: display judge name and title on docket description; --- .../status-report-order-description-fields.cy.ts | 9 ++++----- .../sequences/gotoAddCourtIssuedDocketEntrySequence.ts | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts index 8063b6b6c20..d07e42b1d12 100644 --- a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts +++ b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts @@ -46,17 +46,17 @@ describe('should default status report order descriptions', () => { 'have.value', `. Parties by ${today} shall file a status report. Case is stricken from the current trial session.`, ); - cy.get('#judge-label').click(); + cy.get('[data-testid="judge-select"]').should('have.value', 'Colvin'); cy.get('[data-testid="docket-entry-preview-text"]').should( 'have.text', - `Docket entry preview: Order that jurisdiction is retained by Colvin. Parties by ${today} shall file a status report. Case is stricken from the current trial session.`, + `Docket entry preview: Order that jurisdiction is retained by Judge Colvin. Parties by ${today} shall file a status report. Case is stricken from the current trial session.`, ); }); }); function judgeCreatesAndSavesStatusReportOrder( today: string, - jurisdictionRetain: boolean = false, + jurisdictionRetained: boolean = false, ) { loginAsColvin(); cy.visit(`/case-detail/${docketNumber}`); @@ -66,9 +66,8 @@ function judgeCreatesAndSavesStatusReportOrder( cy.get('[data-testid="order-type-status-report"]').check({ force: true }); cy.get('#status-report-due-date-picker').type(today); - if (jurisdictionRetain) { + if (jurisdictionRetained) { cy.get('#stricken-from-trial-sessions-label').click(); - cy.get( '#jurisdiction-form-group > :nth-child(2) > .usa-radio__label', ).click(); diff --git a/web-client/src/presenter/sequences/gotoAddCourtIssuedDocketEntrySequence.ts b/web-client/src/presenter/sequences/gotoAddCourtIssuedDocketEntrySequence.ts index d115deb4354..20c959566fb 100644 --- a/web-client/src/presenter/sequences/gotoAddCourtIssuedDocketEntrySequence.ts +++ b/web-client/src/presenter/sequences/gotoAddCourtIssuedDocketEntrySequence.ts @@ -1,4 +1,5 @@ import { clearFormAction } from '../actions/clearFormAction'; +import { computeJudgeNameWithTitleAction } from '@web-client/presenter/actions/computeJudgeNameWithTitleAction'; import { generateCourtIssuedDocumentTitleAction } from '../actions/CourtIssuedDocketEntry/generateCourtIssuedDocumentTitleAction'; import { getCaseAction } from '../actions/getCaseAction'; import { getFilterCurrentJudgeUsersAction } from '../actions/getFilterCurrentJudgeUsersAction'; @@ -28,6 +29,7 @@ export const gotoAddCourtIssuedDocketEntrySequence = setDocketEntryIdAction, setCourtIssuedDocumentInitialDataAction, setDefaultServiceStampAction, + computeJudgeNameWithTitleAction, generateCourtIssuedDocumentTitleAction, setIsEditingDocketEntryAction(false), setupCurrentPageAction('CourtIssuedDocketEntry'), From 2c505528556f2f3ec2fc34f5ada79d60038c922a Mon Sep 17 00:00:00 2001 From: TomElliottFlexion <66225176+TomElliottFlexion@users.noreply.github.com> Date: Thu, 12 Dec 2024 11:58:10 -0600 Subject: [PATCH 06/10] 10489: update court issued document action to use judge full name rather than unused signedByUserId; updated cypress integration test to check for chambers user edge case --- ...atus-report-order-description-fields.cy.ts | 37 +++++++++++++++++-- ...urtIssuedDocumentInitialDataAction.test.ts | 28 +++++++++++--- ...setCourtIssuedDocumentInitialDataAction.ts | 7 +++- 3 files changed, 61 insertions(+), 11 deletions(-) diff --git a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts index d07e42b1d12..0fbe8225eb2 100644 --- a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts +++ b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts @@ -8,6 +8,7 @@ import { } from '../../../support/statusReportOrder'; import { loginAsColvin, + loginAsColvinChambers, loginAsDocketClerk, } from '../../../../helpers/authentication/login-as-helpers'; import { logout } from '../../../../helpers/authentication/logout'; @@ -15,7 +16,7 @@ import { logout } from '../../../../helpers/authentication/logout'; describe('should default status report order descriptions', () => { const today = formatNow(FORMATS.MMDDYYYY); it('should display default description when document type is an Order', () => { - judgeCreatesAndSavesStatusReportOrder(today); + judgeOrChambersCreatesStatusReportOrder(today); loginAsDocketClerk(); cy.visit(`/case-detail/${docketNumber}`); cy.get('#tab-drafts').click(); @@ -31,8 +32,31 @@ describe('should default status report order descriptions', () => { `Docket entry preview: Order parties by ${today} shall file a status report.`, ); }); + it('should set event code to OJR when case is stricken from trial session and jurisdiction is retained and display default description', () => { - judgeCreatesAndSavesStatusReportOrder(today, true); + judgeOrChambersCreatesStatusReportOrder(today, true); + loginAsDocketClerk(); + cy.visit(`/case-detail/${docketNumber}`); + cy.get('#tab-drafts').click(); + getLastDraftOrderElementFromDrafts().click(); + cy.get('[data-testid="add-court-issued-docket-entry-button"]').click(); + cy.get('.select-react-element__control').should( + 'have.text', + 'Order that jurisdiction is retained', + ); + cy.get('[data-testid="document-description-input"]').should( + 'have.value', + `. Parties by ${today} shall file a status report. Case is stricken from the current trial session.`, + ); + cy.get('[data-testid="judge-select"]').should('have.value', 'Colvin'); + cy.get('[data-testid="docket-entry-preview-text"]').should( + 'have.text', + `Docket entry preview: Order that jurisdiction is retained by Judge Colvin. Parties by ${today} shall file a status report. Case is stricken from the current trial session.`, + ); + }); + + it('should set event code to OJR when case is stricken from trial session and jurisdiction is retained and display default description', () => { + judgeOrChambersCreatesStatusReportOrder(today, true, true); loginAsDocketClerk(); cy.visit(`/case-detail/${docketNumber}`); cy.get('#tab-drafts').click(); @@ -54,11 +78,16 @@ describe('should default status report order descriptions', () => { }); }); -function judgeCreatesAndSavesStatusReportOrder( +function judgeOrChambersCreatesStatusReportOrder( today: string, jurisdictionRetained: boolean = false, + chambersUser: boolean = false, ) { - loginAsColvin(); + if (chambersUser) { + loginAsColvinChambers(); + } else { + loginAsColvin(); + } cy.visit(`/case-detail/${docketNumber}`); cy.get('#tab-document-view').click(); cy.contains('Status Report').click(); diff --git a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts index 98398ba3e31..5011bcd8f7c 100644 --- a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts +++ b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts @@ -9,6 +9,7 @@ describe('setCourtIssuedDocumentInitialDataAction', () => { 'ddfd978d-6be6-4877-b004-2b5735a41fee', '11597d22-0874-4c5e-ac98-a843d1472baf', '22597d22-0874-4c5e-ac98-a843d1472baf', + '43737877-0874-4c5e-ac98-dhd83838887j', ]; beforeAll(() => { @@ -27,6 +28,13 @@ describe('setCourtIssuedDocumentInitialDataAction', () => { docketEntryId: docketEntryIds[2], eventCode: 'OJR', signedByUserId: '4497d22-0874-4c5e-ac98-a843d1472baf', + signedJudgeName: 'John O. Colvin', + }); + MOCK_CASE.docketEntries.push({ + docketEntryId: docketEntryIds[3], + eventCode: 'OJR', + signedByUserId: 'not-colvins-id', + signedJudgeName: 'John O. Colvin', }); }); @@ -121,35 +129,43 @@ describe('setCourtIssuedDocumentInitialDataAction', () => { presenter, }, props: { - docketEntryId: '22597d22-0874-4c5e-ac98-a843d1472baf', + docketEntryId: docketEntryIds[2], }, state: { caseDetail: MOCK_CASE, form: {}, judges: [ - { name: 'Colvin', userId: '4497d22-0874-4c5e-ac98-a843d1472baf' }, + { + judgeFullName: 'John O. Colvin', + name: 'Colvin', + userId: '4497d22-0874-4c5e-ac98-a843d1472baf', + }, ], }, }); expect(result.state.form.judge).toEqual('Colvin'); }); - it('should not set the judge name when eventcode is OJR and docketEntry was signed by a non judge user', async () => { + it('should set the judge name when eventcode is OJR and docketEntry was signed by a non judge user', async () => { const result = await runAction(setCourtIssuedDocumentInitialDataAction, { modules: { presenter, }, props: { - docketEntryId: '22597d22-0874-4c5e-ac98-a843d1472baf', + docketEntryId: docketEntryIds[3], }, state: { caseDetail: MOCK_CASE, form: {}, judges: [ - { name: 'Cohen', userId: '3297d22-0874-4c5e-ac98-a843d1472baf' }, + { + judgeFullName: 'John O. Colvin', + name: 'Colvin', + userId: '4497d22-0874-4c5e-ac98-a843d1472baf', + }, ], }, }); - expect(result.state.form.judge).toEqual(undefined); + expect(result.state.form.judge).toEqual('Colvin'); }); }); diff --git a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.ts b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.ts index 0fbd5c9596a..92e9db0309a 100644 --- a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.ts +++ b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.ts @@ -38,8 +38,13 @@ export const setCourtIssuedDocumentInitialDataAction = ({ if (docketEntry.eventCode === 'OJR') { const signingJudge = judges.find(judge => { - return judge.userId === docketEntry.signedByUserId; + return ( + judge.judgeFullName && + docketEntry.signedJudgeName && + judge.judgeFullName === docketEntry.signedJudgeName + ); }); + if (signingJudge) { store.set(state.form.judge, signingJudge.name); } From 1270678db073248ab45c33f4cb0e53c510c263a4 Mon Sep 17 00:00:00 2001 From: TomElliottFlexion <66225176+TomElliottFlexion@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:00:42 -0600 Subject: [PATCH 07/10] 10489: update cypress test description --- .../status-report-order-description-fields.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts index 0fbe8225eb2..05c61b03f62 100644 --- a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts +++ b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts @@ -55,7 +55,7 @@ describe('should default status report order descriptions', () => { ); }); - it('should set event code to OJR when case is stricken from trial session and jurisdiction is retained and display default description', () => { + it('should continue to handle OJR and set correct signing judge when status order report is signed by chambers user', () => { judgeOrChambersCreatesStatusReportOrder(today, true, true); loginAsDocketClerk(); cy.visit(`/case-detail/${docketNumber}`); From 677b95f06410bf827ed047cd6076ba8cfdf57739 Mon Sep 17 00:00:00 2001 From: Tejha Bollu Date: Tue, 17 Dec 2024 11:00:52 -0500 Subject: [PATCH 08/10] 10489: Feedback changes updated --- ...atus-report-order-description-fields.cy.ts | 2 +- .../src/business/entities/EntityConstants.ts | 1 + .../fileCourtIssuedOrderInteractor.test.ts | 41 ++++++++++++------- .../fileCourtIssuedOrderInteractor.ts | 3 +- ...urtIssuedDocumentInitialDataAction.test.ts | 19 +++++---- 5 files changed, 41 insertions(+), 25 deletions(-) diff --git a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts index 0fbe8225eb2..f840bd84747 100644 --- a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts +++ b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts @@ -22,7 +22,7 @@ describe('should default status report order descriptions', () => { cy.get('#tab-drafts').click(); getLastDraftOrderElementFromDrafts().click(); cy.get('[data-testid="add-court-issued-docket-entry-button"]').click(); - cy.get('.select-react-element__control').should('have.text', 'Order'); + cy.get('[data-testid="court-issued-document-type-search"]').should('have.text', 'Order'); cy.get('[data-testid="document-description-input"]').should( 'have.value', `Order parties by ${today} shall file a status report.`, diff --git a/shared/src/business/entities/EntityConstants.ts b/shared/src/business/entities/EntityConstants.ts index 9fb2dae09a2..c09010ccf4f 100644 --- a/shared/src/business/entities/EntityConstants.ts +++ b/shared/src/business/entities/EntityConstants.ts @@ -35,6 +35,7 @@ export const DOCUMENT_EXTERNAL_CATEGORIES_MAP: { } = externalFilingEventsJson; export const COURT_ISSUED_EVENT_CODES = courtIssuedEventCodesJson; +export const EVENT_CODES_THAT_ALLOW_FREE_TEXT = ['O', 'NOT', 'OJR']; export const DOCKET_NUMBER_MATCHER = /^([1-9]\d{2,4}-\d{2})$/; export const CURRENT_YEAR = +formatNow(FORMATS.YEAR); diff --git a/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts b/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts index 0543eca983c..0369a28de07 100644 --- a/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts +++ b/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts @@ -7,7 +7,7 @@ import { COUNTRY_TYPES, PARTY_TYPES, PETITIONS_SECTION, - ROLES, + ROLES, STATUS_REPORT_ORDER_OPTIONS, } from '../../../../../shared/src/business/entities/EntityConstants'; import { MOCK_LOCK } from '../../../../../shared/src/test/mockLock'; import { ServiceUnavailableError } from '@web-api/errors/errors'; @@ -521,7 +521,8 @@ describe('fileCourtIssuedOrderInteractor', () => { draftOrderState: {}, dueDate: '2024-11-05', eventCode: 'O', - orderType: 'statusReport', + orderType: + STATUS_REPORT_ORDER_OPTIONS.orderTypeOptions.statusReport, strickenFromTrialSessions: false, }, primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', @@ -551,7 +552,8 @@ describe('fileCourtIssuedOrderInteractor', () => { draftOrderState: {}, dueDate: '2024-11-05', eventCode: 'O', - orderType: 'statusReport', + orderType: + STATUS_REPORT_ORDER_OPTIONS.orderTypeOptions.statusReport, strickenFromTrialSessions: true, }, primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', @@ -583,8 +585,10 @@ describe('fileCourtIssuedOrderInteractor', () => { draftOrderState: {}, dueDate: '2024-11-05', eventCode: 'O', - jurisdiction: 'restoredToGeneralDocket', - orderType: 'statusReport', + jurisdiction: + STATUS_REPORT_ORDER_OPTIONS.jurisdictionOptions.restored, + orderType: + STATUS_REPORT_ORDER_OPTIONS.orderTypeOptions.statusReport, strickenFromTrialSessions: true, }, primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', @@ -616,7 +620,8 @@ describe('fileCourtIssuedOrderInteractor', () => { draftOrderState: {}, dueDate: '2024-11-05', eventCode: 'O', - orderType: 'statusReportStipulatedDecision', + orderType: + STATUS_REPORT_ORDER_OPTIONS.orderTypeOptions.stipulatedDecision, strickenFromTrialSessions: false, }, primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', @@ -648,7 +653,8 @@ describe('fileCourtIssuedOrderInteractor', () => { draftOrderState: {}, dueDate: '2024-11-05', eventCode: 'O', - orderType: 'statusReportStipulatedDecision', + orderType: + STATUS_REPORT_ORDER_OPTIONS.orderTypeOptions.stipulatedDecision, strickenFromTrialSessions: true, }, primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', @@ -680,8 +686,10 @@ describe('fileCourtIssuedOrderInteractor', () => { draftOrderState: {}, dueDate: '2024-11-05', eventCode: 'O', - jurisdiction: 'restoredToGeneralDocket', - orderType: 'statusReportStipulatedDecision', + jurisdiction: + STATUS_REPORT_ORDER_OPTIONS.jurisdictionOptions.restored, + orderType: + STATUS_REPORT_ORDER_OPTIONS.orderTypeOptions.stipulatedDecision, strickenFromTrialSessions: true, }, primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', @@ -716,8 +724,10 @@ describe('fileCourtIssuedOrderInteractor', () => { draftOrderState: {}, dueDate: '2024-11-05', eventCode: 'O', - jurisdiction: 'retained', - orderType: 'statusReport', + jurisdiction: + STATUS_REPORT_ORDER_OPTIONS.jurisdictionOptions.retained, + orderType: + STATUS_REPORT_ORDER_OPTIONS.orderTypeOptions.statusReport, strickenFromTrialSessions: true, }, primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', @@ -749,8 +759,10 @@ describe('fileCourtIssuedOrderInteractor', () => { draftOrderState: {}, dueDate: '2024-11-05', eventCode: 'O', - jurisdiction: 'retained', - orderType: 'statusReportStipulatedDecision', + jurisdiction: + STATUS_REPORT_ORDER_OPTIONS.jurisdictionOptions.retained, + orderType: + STATUS_REPORT_ORDER_OPTIONS.orderTypeOptions.stipulatedDecision, strickenFromTrialSessions: true, }, primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', @@ -781,7 +793,8 @@ describe('fileCourtIssuedOrderInteractor', () => { docketNumber: caseRecord.docketNumber, draftOrderState: {}, eventCode: 'O', - jurisdiction: 'retained', + jurisdiction: + STATUS_REPORT_ORDER_OPTIONS.jurisdictionOptions.retained, strickenFromTrialSessions: true, }, primaryDocumentFileId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb', diff --git a/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.ts b/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.ts index 796a0381cb4..fb552b2ac90 100644 --- a/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.ts +++ b/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.ts @@ -1,6 +1,7 @@ import { COURT_ISSUED_EVENT_CODES, DOCUMENT_RELATIONSHIPS, + EVENT_CODES_THAT_ALLOW_FREE_TEXT, } from '../../../../../shared/src/business/entities/EntityConstants'; import { Case } from '../../../../../shared/src/business/entities/cases/Case'; import { DocketEntry } from '../../../../../shared/src/business/entities/DocketEntry'; @@ -58,7 +59,7 @@ export const fileCourtIssuedOrder = async ( documentMetadata.eventCode = 'OJR'; } - if (['O', 'NOT', 'OJR'].includes(documentMetadata.eventCode)) { + if (EVENT_CODES_THAT_ALLOW_FREE_TEXT.includes(documentMetadata.eventCode)) { const freeText = generateFreeText(documentMetadata); documentMetadata.freeText = freeText; if (documentMetadata.draftOrderState) { diff --git a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts index 5011bcd8f7c..35677f590f7 100644 --- a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts +++ b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts @@ -3,6 +3,7 @@ import { applicationContextForClient as applicationContext } from '@web-client/t import { presenter } from '../../presenter-mock'; import { runAction } from '@web-client/presenter/test.cerebral'; import { setCourtIssuedDocumentInitialDataAction } from './setCourtIssuedDocumentInitialDataAction'; +import {judgeColvin} from "@shared/test/mockUsers"; describe('setCourtIssuedDocumentInitialDataAction', () => { const docketEntryIds = [ @@ -27,14 +28,14 @@ describe('setCourtIssuedDocumentInitialDataAction', () => { MOCK_CASE.docketEntries.push({ docketEntryId: docketEntryIds[2], eventCode: 'OJR', - signedByUserId: '4497d22-0874-4c5e-ac98-a843d1472baf', - signedJudgeName: 'John O. Colvin', + signedByUserId: judgeColvin.userId, + signedJudgeName: judgeColvin.judgeFullName, }); MOCK_CASE.docketEntries.push({ docketEntryId: docketEntryIds[3], eventCode: 'OJR', signedByUserId: 'not-colvins-id', - signedJudgeName: 'John O. Colvin', + signedJudgeName: judgeColvin.judgeFullName, }); }); @@ -136,9 +137,9 @@ describe('setCourtIssuedDocumentInitialDataAction', () => { form: {}, judges: [ { - judgeFullName: 'John O. Colvin', - name: 'Colvin', - userId: '4497d22-0874-4c5e-ac98-a843d1472baf', + judgeFullName: judgeColvin.judgeFullName, + name: judgeColvin.name, + userId: judgeColvin.userId, }, ], }, @@ -159,9 +160,9 @@ describe('setCourtIssuedDocumentInitialDataAction', () => { form: {}, judges: [ { - judgeFullName: 'John O. Colvin', - name: 'Colvin', - userId: '4497d22-0874-4c5e-ac98-a843d1472baf', + judgeFullName: judgeColvin.judgeFullName, + name: judgeColvin.name, + userId: judgeColvin.userId, }, ], }, From ef74cc9d329650143ffe90c29b397f335b79c1d3 Mon Sep 17 00:00:00 2001 From: TomElliottFlexion <66225176+TomElliottFlexion@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:28:10 -0600 Subject: [PATCH 09/10] 10489: formatting --- .../status-report-order-description-fields.cy.ts | 5 ++++- shared/src/business/entities/EntityConstants.ts | 1 + .../courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts | 3 ++- .../setCourtIssuedDocumentInitialDataAction.test.ts | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts index 0963c4aee7c..38391ce1119 100644 --- a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts +++ b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts @@ -22,7 +22,10 @@ describe('should default status report order descriptions', () => { cy.get('#tab-drafts').click(); getLastDraftOrderElementFromDrafts().click(); cy.get('[data-testid="add-court-issued-docket-entry-button"]').click(); - cy.get('[data-testid="court-issued-document-type-search"]').should('have.text', 'Order'); + cy.get('[data-testid="court-issued-document-type-search"]').should( + 'have.text', + 'Order', + ); cy.get('[data-testid="document-description-input"]').should( 'have.value', `Order parties by ${today} shall file a status report.`, diff --git a/shared/src/business/entities/EntityConstants.ts b/shared/src/business/entities/EntityConstants.ts index c09010ccf4f..7ca9895cc1a 100644 --- a/shared/src/business/entities/EntityConstants.ts +++ b/shared/src/business/entities/EntityConstants.ts @@ -36,6 +36,7 @@ export const DOCUMENT_EXTERNAL_CATEGORIES_MAP: { export const COURT_ISSUED_EVENT_CODES = courtIssuedEventCodesJson; export const EVENT_CODES_THAT_ALLOW_FREE_TEXT = ['O', 'NOT', 'OJR']; + export const DOCKET_NUMBER_MATCHER = /^([1-9]\d{2,4}-\d{2})$/; export const CURRENT_YEAR = +formatNow(FORMATS.YEAR); diff --git a/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts b/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts index 0369a28de07..b9b79a2ac5b 100644 --- a/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts +++ b/web-api/src/business/useCases/courtIssuedOrder/fileCourtIssuedOrderInteractor.test.ts @@ -7,7 +7,8 @@ import { COUNTRY_TYPES, PARTY_TYPES, PETITIONS_SECTION, - ROLES, STATUS_REPORT_ORDER_OPTIONS, + ROLES, + STATUS_REPORT_ORDER_OPTIONS, } from '../../../../../shared/src/business/entities/EntityConstants'; import { MOCK_LOCK } from '../../../../../shared/src/test/mockLock'; import { ServiceUnavailableError } from '@web-api/errors/errors'; diff --git a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts index 35677f590f7..a5ac411f5e8 100644 --- a/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts +++ b/web-client/src/presenter/actions/CourtIssuedDocketEntry/setCourtIssuedDocumentInitialDataAction.test.ts @@ -1,9 +1,9 @@ import { MOCK_CASE } from '../../../../../shared/src/test/mockCase'; import { applicationContextForClient as applicationContext } from '@web-client/test/createClientTestApplicationContext'; +import { judgeColvin } from '@shared/test/mockUsers'; import { presenter } from '../../presenter-mock'; import { runAction } from '@web-client/presenter/test.cerebral'; import { setCourtIssuedDocumentInitialDataAction } from './setCourtIssuedDocumentInitialDataAction'; -import {judgeColvin} from "@shared/test/mockUsers"; describe('setCourtIssuedDocumentInitialDataAction', () => { const docketEntryIds = [ From e98729c07499357692adde263e49d07d55cd75cd Mon Sep 17 00:00:00 2001 From: TomElliottFlexion <66225176+TomElliottFlexion@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:32:46 -0600 Subject: [PATCH 10/10] 10489: use data-testid selectors consistently --- .../status-report-order-description-fields.cy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts index 38391ce1119..8b7d96fa55d 100644 --- a/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts +++ b/cypress/local-only/tests/integration/statusReportOrder/status-report-order-description-fields.cy.ts @@ -43,7 +43,7 @@ describe('should default status report order descriptions', () => { cy.get('#tab-drafts').click(); getLastDraftOrderElementFromDrafts().click(); cy.get('[data-testid="add-court-issued-docket-entry-button"]').click(); - cy.get('.select-react-element__control').should( + cy.get('[data-testid="court-issued-document-type-search"]').should( 'have.text', 'Order that jurisdiction is retained', ); @@ -65,7 +65,7 @@ describe('should default status report order descriptions', () => { cy.get('#tab-drafts').click(); getLastDraftOrderElementFromDrafts().click(); cy.get('[data-testid="add-court-issued-docket-entry-button"]').click(); - cy.get('.select-react-element__control').should( + cy.get('[data-testid="court-issued-document-type-search"]').should( 'have.text', 'Order that jurisdiction is retained', );