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

10363: Undo Changes of experiment; Revert feature back to Staging; #5376

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@ import {
MOCK_MINUTE_ENTRY,
STANDING_PRETRIAL_ORDER_ENTRY,
} from '@shared/test/mockDocketEntry';
import {
DownloadDocketEntryRequestType,
batchDownloadDocketEntriesInteractor,
} from '@web-api/business/useCases/document/batchDownloadDocketEntriesInteractor';
import { MOCK_CASE } from '@shared/test/mockCase';
import { applicationContext } from '../../../../../shared/src/business/test/createTestApplicationContext';
import { batchDownloadDocketEntriesInteractor } from '@web-api/business/useCases/document/batchDownloadDocketEntriesInteractor';
import {
mockDocketClerkUser,
mockPrivatePractitionerUser,
Expand All @@ -33,19 +30,18 @@ describe('batchDownloadDocketEntriesInteractor', () => {
STANDING_PRETRIAL_ORDER_ENTRY.docketEntryId,
];

let requestParams: DownloadDocketEntryRequestType;
const TEST_GUID = 'TEST_GUID';
const TEST_BATCH_INDEX = 1;
let requestParams: {
clientConnectionId: string;
docketNumber: string;
documentsSelectedForDownload: string[];
printableDocketRecordFileId?: string;
};

beforeEach(() => {
requestParams = {
clientConnectionId: mockClientConnectionId,
docketNumber: MOCK_CASE.docketNumber,
documentsSelectedForDownload: mockDocumentsSelectedForDownload,
index: TEST_BATCH_INDEX,
totalNumberOfBatches: 1,
totalNumberOfFiles: 0,
uuid: TEST_GUID,
};
applicationContext
.getPersistenceGateway()
Expand Down Expand Up @@ -177,7 +173,7 @@ describe('batchDownloadDocketEntriesInteractor', () => {
},
],
onProgress: expect.anything(),
outputZipName: `${TEST_GUID}-${TEST_BATCH_INDEX}.zip`,
outputZipName: '101-18, Test Petitioner.zip',
});
});

Expand Down Expand Up @@ -218,7 +214,7 @@ describe('batchDownloadDocketEntriesInteractor', () => {
},
],
onProgress: expect.anything(),
outputZipName: `${TEST_GUID}-${TEST_BATCH_INDEX}.zip`,
outputZipName: '101-18, Test Petitioner.zip',
});
});

Expand All @@ -235,12 +231,8 @@ describe('batchDownloadDocketEntriesInteractor', () => {
applicationContext: expect.anything(),
clientConnectionId: mockClientConnectionId,
message: {
action: 'docket_entries_batch_download_ready',
caseFolder: '101-18, Test Petitioner',
index: TEST_BATCH_INDEX,
totalNumberOfBatches: 1,
action: 'batch_download_ready',
url: MOCK_URL,
uuid: TEST_GUID,
},
userId: mockDocketClerkUser.userId,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ export type DownloadDocketEntryRequestType = {
clientConnectionId: string;
docketNumber: string;
printableDocketRecordFileId?: string;
index: number;
totalNumberOfBatches: number;
totalNumberOfFiles: number;
uuid: string;
};

export const batchDownloadDocketEntriesInteractor = async (
Expand Down Expand Up @@ -59,11 +55,7 @@ const batchDownloadDocketEntriesHelper = async (
clientConnectionId,
docketNumber,
documentsSelectedForDownload,
index: batchIndex,
printableDocketRecordFileId,
totalNumberOfBatches,
totalNumberOfFiles,
uuid,
}: DownloadDocketEntryRequestType,
authorizedUser: UnknownAuthUser,
): Promise<void> => {
Expand All @@ -80,12 +72,9 @@ const batchDownloadDocketEntriesHelper = async (
applicationContext,
clientConnectionId,
message: {
action: 'docket_entries_batch_download_progress',
action: 'batch_download_progress',
filesCompleted: 0,
index: batchIndex,
totalFiles: totalNumberOfFiles,
totalNumberOfBatches,
uuid,
totalFiles: documentsSelectedForDownload.length,
},
userId: authorizedUser.userId,
});
Expand All @@ -104,7 +93,7 @@ const batchDownloadDocketEntriesHelper = async (
const { caseCaption, isSealed: isCaseSealed } = caseToBatch;
const caseTitle = Case.getCaseTitle(caseCaption);
const caseFolder = `${docketNumber}, ${caseTitle}`;
const zipName = `${uuid}-${batchIndex}.zip`;
const zipName = `${caseFolder}.zip`;
const documentsToZip: {
key: string;
filePathInZip: string;
Expand Down Expand Up @@ -152,11 +141,9 @@ const batchDownloadDocketEntriesHelper = async (
applicationContext,
clientConnectionId,
message: {
action: 'docket_entries_batch_download_progress',
action: 'batch_download_progress',
filesCompleted: progressData.filesCompleted,
index: batchIndex,
totalFiles: totalNumberOfFiles,
uuid,
totalFiles: progressData.totalFiles,
},
userId: authorizedUser.userId,
});
Expand All @@ -175,20 +162,15 @@ const batchDownloadDocketEntriesHelper = async (
.getDownloadPolicyUrl({
applicationContext,
key: zipName,
urlTtl: 60 * 60 * 2,
useTempBucket: true,
});

await applicationContext.getNotificationGateway().sendNotificationToUser({
applicationContext,
clientConnectionId,
message: {
action: 'docket_entries_batch_download_ready',
caseFolder,
index: batchIndex,
totalNumberOfBatches,
action: 'batch_download_ready',
url,
uuid,
},
userId: authorizedUser.userId,
});
Expand Down
2 changes: 0 additions & 2 deletions web-client/src/applicationContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ import { deletePractitionerDocumentInteractor } from '../../shared/src/proxies/p
import { deleteTrialSessionInteractor } from '../../shared/src/proxies/trialSessions/deleteTrialSessionProxy';
import { deleteUserCaseNoteInteractor } from '../../shared/src/proxies/caseNote/deleteUserCaseNoteProxy';
import { dismissNOTTReminderForTrialInteractor } from '../../shared/src/proxies/trialSessions/dismissNOTTReminderForTrialProxy';
import { downloadBlob } from '@web-client/presenter/utilities/downloadBlob';
import { downloadCsv } from '@web-client/presenter/utilities/downloadCsv';
import { editPaperFilingInteractor } from '../../shared/src/proxies/documents/editPaperFilingProxy';
import { editPractitionerDocumentInteractor } from '../../shared/src/proxies/practitioners/editPractitionerDocumentProxy';
Expand Down Expand Up @@ -731,7 +730,6 @@ const applicationContext = {
createStartOfDayISO,
dateStringsCompared,
deconstructDate,
downloadBlob,
downloadCsv,
filterEmptyStrings,
formatAttachments,
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,15 @@ export const batchDownloadDocketEntriesAction = async ({
docketRecordFilter,
});

const batchSize = 50;
const batchedDocumentIds: string[][] = [];
const uuid = applicationContext.getUniqueId();

for (let i = 0; i < filteredDocumentsIds.length; i += batchSize) {
const batchSlice = filteredDocumentsIds.slice(i, i + batchSize);
batchedDocumentIds.push(batchSlice);
}

const totalNumberOfFiles = props.fileId
? filteredDocumentsIds.length + 1
: filteredDocumentsIds.length;

try {
await Promise.all(
batchedDocumentIds.map((batch, index) =>
applicationContext
.getUseCases()
.batchDownloadDocketEntriesInteractor(applicationContext, {
clientConnectionId,
docketNumber,
documentsSelectedForDownload: batch,
index,
printableDocketRecordFileId: !index ? props.fileId : undefined,
totalNumberOfBatches: batchedDocumentIds.length,
totalNumberOfFiles,
uuid,
}),
),
);
await applicationContext
.getUseCases()
.batchDownloadDocketEntriesInteractor(applicationContext, {
clientConnectionId,
docketNumber,
documentsSelectedForDownload: filteredDocumentsIds,
printableDocketRecordFileId: props.fileId,
});

return path.success();
} catch (e) {
Expand Down
6 changes: 0 additions & 6 deletions web-client/src/presenter/presenter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,8 +517,6 @@ import { updateCourtIssuedDocketEntryFormValueSequence } from './sequences/updat
import { updateCourtIssuedDocketEntryTitleSequence } from '@web-client/presenter/sequences/updateCourtIssuedDocketEntryTitleSequence';
import { updateCreateOrderModalFormValueSequence } from './sequences/updateCreateOrderModalFormValueSequence';
import { updateDateRangeForDeadlinesSequence } from './sequences/updateDateRangeForDeadlinesSequence';
import { updateDocketEntriesBatchDownloadDownloadSequence } from '@web-client/presenter/sequences/updateDocketEntriesBatchDownloadDownloadSequence';
import { updateDocketEntriesBatchDownloadProgressSequence } from '@web-client/presenter/sequences/updateDocketEntriesBatchDownloadProgressSequence';
import { updateDocketEntryFormValueSequence } from './sequences/updateDocketEntryFormValueSequence';
import { updateDocketEntryMetaDocumentFormValueSequence } from './sequences/updateDocketEntryMetaDocumentFormValueSequence';
import { updateDocketEntryWorksheetSequence } from '@web-client/presenter/sequences/updateDocketEntryWorksheetSequence';
Expand Down Expand Up @@ -1444,10 +1442,6 @@ export const presenterSequences = {
updateCreateOrderModalFormValueSequence as unknown as Function,
updateDateRangeForDeadlinesSequence:
updateDateRangeForDeadlinesSequence as unknown as Function,
updateDocketEntriesBatchDownloadDownloadSequence:
updateDocketEntriesBatchDownloadDownloadSequence as unknown as Function,
updateDocketEntriesBatchDownloadProgressSequence:
updateDocketEntriesBatchDownloadProgressSequence as unknown as Function,
updateDocketEntryFormValueSequence:
updateDocketEntryFormValueSequence as unknown as Function,
updateDocketEntryMetaDocumentFormValueSequence:
Expand Down

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions web-client/src/presenter/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -655,12 +655,6 @@ export const baseState = {
},
},
customCaseReport: cloneDeep(initialCustomCaseReportState),
docketEntriesBatchDownload: {} as {
[uuid: string]: { index: number; url: string }[];
},
docketEntriesBatchDownloadProgress: {} as {
[uuid: string]: { [index: number]: number };
},
docketEntryId: null,
docketRecordIndex: 0,
documentToEdit: {} as any,
Expand Down
Loading
Loading