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

Save voter session on ballot spoil #4465

Merged
merged 13 commits into from
Jan 9, 2024

Conversation

kshen0
Copy link
Contributor

@kshen0 kshen0 commented Jan 3, 2024

Overview

#3909

Improves the flow for spoiling a ballot in post-print ballot validation

  • Rather than restarting the voter session, the session is saved. The voter is returned to the review screen after the poll worker removes the old ballot, loads a new sheet, and removes their card
  • The ballot spoil flow now checks that the ballot is removed by the poll worker before allowing the poll worker to continue

Demo Video or Screenshot

Happy path

IMG_4641.mov

Lightly stress testing pulling paper early and repeated auth changes

IMG_4642.mov

Testing Plan

  • updated component and e2e tests

Checklist

  • I have added logging where appropriate to any new user actions, system updates such as file reads or storage writes, or errors introduced. (no new actions or errors introduced)
  • I have added a screenshot and/or video to this PR to demo the change
  • I have added the "user_facing_change" label to this PR to automate an announcement in #machine-product-updates

@CLAassistant
Copy link

CLAassistant commented Jan 3, 2024

CLA assistant check
All committers have signed the CLA.

kshen0 added 11 commits January 4, 2024 21:06
render BallotInvalidatedPage outside ballot context because ballot
context is no longer needed
Previously only a cardless voter session could render LoadPaperPage. We
now also want to render it when poll worker auth is active, as will be
the case when a poll worker has removed a ballot to spoil and needs to
load a new sheet
Updates to tests in this PR require finer control of the mock state
machine, so we don't want to always set the state machine state when
setting expectations
@kshen0 kshen0 force-pushed the kevin/save-voter-session-on-ballot-spoil-3909 branch from bf7d9e0 to 9adeae4 Compare January 5, 2024 05:26
@@ -90,7 +90,7 @@ type PaperHandlerStatusEvent =
| { type: 'VOTER_INITIATED_PRINT'; pdfData: Buffer }
| { type: 'PAPER_IN_OUTPUT' }
| { type: 'PAPER_IN_INPUT' }
| { type: 'VOTER_CONFIRMED_INVALIDATED_BALLOT' }
| { type: 'POLLWORKER_CONFIRMED_INVALIDATED_BALLOT' }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a misnomer; the voter is not actually the one who confirms the ballot is has been invalidated

on: {
POLLWORKER_CONFIRMED_INVALIDATED_BALLOT: 'done',
},
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The copy changes based on whether paper is present

Copy link
Collaborator

Choose a reason for hiding this comment

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

paper_nowhere is a little confusing. Maybe no_paper or paper_absent?

@@ -33,7 +33,7 @@ beforeEach(() => {
apiMock = createApiMock();
kiosk = fakeKiosk();
window.kiosk = kiosk;
apiMock.setPaperHandlerState('waiting_for_ballot_data');
Copy link
Contributor Author

@kshen0 kshen0 Jan 5, 2024

Choose a reason for hiding this comment

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

These e2e tests "incorrectly" mocked paper handler state; the old mocking seen here was simpler but a less accurate representation of states at various points of the e2e test. It wasn't an issue before now because of the order we rendered LoadPaperPage in (ie. it used to be lower priority)

paperPresent={
stateMachineState ===
'waiting_for_invalidated_ballot_confirmation.paper_present'
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seemed clearer to pass this prop down rather than query for state in the lower components, but open to feedback

Copy link
Collaborator

Choose a reason for hiding this comment

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

seems fine to me!

ballotContextProviderChild = (
<BallotInvalidatedPage authStatus={authStatus} />
);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we are no longer restarting the voting session, we don't need access to BallotContext

onSuccess() {
setSelectedCardlessVoterPrecinctId(precinct.id);
},
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was redundant with another call to setAcceptingPaperStateMutation.mutate that happens after ballot style selection

@kshen0 kshen0 changed the title WIP Kevin/save voter session on ballot spoil 3909 Save voter session on ballot spoil Jan 5, 2024
@kshen0 kshen0 requested a review from jonahkagan January 5, 2024 05:49
const history = useHistory();
useEffect(() => {
history.push('/ready-to-review');
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed before, not ideal to use react-router routing here. Should be simplified in #3985

@kshen0 kshen0 marked this pull request as ready for review January 5, 2024 19:39
Copy link
Collaborator

@jonahkagan jonahkagan left a comment

Choose a reason for hiding this comment

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

Thanks for the clear PR!

on: {
POLLWORKER_CONFIRMED_INVALIDATED_BALLOT: 'done',
},
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

paper_nowhere is a little confusing. Maybe no_paper or paper_absent?

paperPresent={
stateMachineState ===
'waiting_for_invalidated_ballot_confirmation.paper_present'
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

seems fine to me!

return (
<AskPollWorkerPage
authStatus={authStatus}
pollWorkerPage={<RemoveInvalidatedBallotPage />}
pollWorkerPage={
<RemoveInvalidatedBallotPage paperPresent={paperPresent} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

I noticed in the video that the "Ask a Poll Worker for Help" text wraps awkwardly to two lines. I think we should look into moving the left-aligned text. Also, the "Voting Session in Progress" screen could use some more horizontal padding - it's butting right up against the sides. But these are minor issues that can be addressed in a future UI polish pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The "Ask a Poll Worker for Help" screen uses the CenteredPageLayout component, which is used by a lot of the app. Agree we should do a design pass on that component and make sure we update all callers at once for consistency.

"Voting Session in Progress" padding was a one-off fix though:

Before

Screenshot 2024-01-09 at 11 48 21 AM

After

Screenshot 2024-01-09 at 11 48 11 AM

It has the same wrapping awkwardness with padding, but at least it's consistent so IMO it's the lesser of two evils. We can fix this and other screens in https://github.com/orgs/votingworks/projects/23/views/75?pane=issue&itemId=49471078

@kshen0 kshen0 merged commit d4b1251 into main Jan 9, 2024
51 checks passed
@kshen0 kshen0 deleted the kevin/save-voter-session-on-ballot-spoil-3909 branch January 9, 2024 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants