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

feat(admin): Ballot Count Report Builder #4019

Merged
merged 15 commits into from
Oct 4, 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
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,9 @@ test('print after preview loaded + test success logging', async () => {
'election_manager',
{
disposition: 'success',
message: 'User printed a custom tally report from the report builder.',
message: 'User printed a tally report.',
filter: '{}',
groupBy: '{}',
}
);
});
Expand Down Expand Up @@ -277,7 +279,9 @@ test('print failure logging', async () => {
{
disposition: 'failure',
message:
'User attempted to print a custom tally report from the report builder, but an error occurred: printer broken',
'User attempted to print a tally report, but an error occurred: printer broken',
filter: '{}',
groupBy: '{}',
}
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,17 +252,23 @@ export function TallyReportViewer({
);

setProgressModalText('Printing Report');
const reportProperties = {
filter: JSON.stringify(filter),
groupBy: JSON.stringify(groupBy),
} as const;
Comment on lines +256 to +259
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a brute force approach to adding information in logging, but I think it's valuable to include this information and, due to the infrequency with which logs will be looked at, not worth investing time in something prettier.

try {
await printElement(reportToPrint, { sides: 'one-sided' });
await logger.log(LogEventId.TallyReportPrinted, userRole, {
message: `User printed a custom tally report from the report builder.`,
message: `User printed a tally report.`,
disposition: 'success',
...reportProperties,
});
} catch (error) {
assert(error instanceof Error);
await logger.log(LogEventId.TallyReportPrinted, userRole, {
message: `User attempted to print a custom tally report from the report builder, but an error occurred: ${error.message}`,
message: `User attempted to print a tally report, but an error occurred: ${error.message}`,
disposition: 'failure',
...reportProperties,
});
} finally {
setProgressModalText(undefined);
Expand Down