~edwargix/tallyard

20d6fd70fee125c7785767df4ac661199b202dd0 — David Florness 2 years ago fe3d28e
Explicitly don't allow showing results of election we're not in

Having this in a separate conditional makes it clear why the program exited.

Supporting showing results of elections the user is not in makes a lot of the
assumptions that tallyard makes throughout the program no longer valid.

In theory this should be supported at some point, but it's not a priority.
1 files changed, 5 insertions(+), 1 deletions(-)

M cmd/tallyard/main.go
M cmd/tallyard/main.go => cmd/tallyard/main.go +5 -1
@@ 111,10 111,14 @@ func main() {
	if err != nil {
		log.Panic(err)
	}
	if el == nil || el.LocalVoter == nil {
	if el == nil {
		// no election selected; user likely hit C-c
		return
	}
	if el.LocalVoter == nil {
		fmt.Println("can't select election of which we are not a member; exiting")
		return
	}

	// wait for election to start if needed
	err = ui.ElectionWaitTUI(kill, client, el, electionsMap.EventStore)