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

change ballot package location on USB #4142

Merged
merged 5 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 8 additions & 3 deletions apps/admin/backend/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { createReadStream, createWriteStream, promises as fs } from 'fs';
import path, { join } from 'path';
import {
BALLOT_PACKAGE_FOLDER,
generateElectionBasedSubfolderName,
generateFilenameForBallotExportPackage,
groupMapToGroupList,
isIntegrationTest,
Expand Down Expand Up @@ -221,12 +222,12 @@ function buildApi({
const electionRecord = getCurrentElectionRecord(workspace);
assert(electionRecord);
const { electionDefinition, id: electionId } = electionRecord;
const { election, electionHash } = electionDefinition;
const systemSettings = store.getSystemSettings(electionId);

const tempDirectory = dirSync().name;
try {
const ballotPackageFileName = generateFilenameForBallotExportPackage(
electionDefinition,
new Date()
);
const tempDirectoryBallotPackageFilePath = join(
Expand Down Expand Up @@ -255,8 +256,12 @@ function buildApi({
ballotPackageZipStream.finish();
await ballotPackageZipPromise.promise;

const usbDriveBallotPackageDirectoryRelativePath = join(
generateElectionBasedSubfolderName(election, electionHash),
BALLOT_PACKAGE_FOLDER
);
const exportBallotPackageResult = await exporter.exportDataToUsbDrive(
BALLOT_PACKAGE_FOLDER,
usbDriveBallotPackageDirectoryRelativePath,
ballotPackageFileName,
createReadStream(tempDirectoryBallotPackageFilePath)
);
Expand All @@ -272,7 +277,7 @@ function buildApi({
filePath: tempDirectoryBallotPackageFilePath,
});
const exportSignatureFileResult = await exporter.exportDataToUsbDrive(
BALLOT_PACKAGE_FOLDER,
usbDriveBallotPackageDirectoryRelativePath,
signatureFile.fileName,
signatureFile.fileContents
);
Expand Down
Loading