From e505b0f21c77752cfcff5d9fa0a8561079ec6989 Mon Sep 17 00:00:00 2001 From: Brian Wiborg Date: Mon, 3 Apr 2023 19:05:45 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20Enhance=20UI=20with=20colorful?= =?UTF-8?q?=20text?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- voting/cli/voting.py | 1 + voting/voting.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/voting/cli/voting.py b/voting/cli/voting.py index 5416a0d..2d077ff 100644 --- a/voting/cli/voting.py +++ b/voting/cli/voting.py @@ -1,6 +1,7 @@ import typer from arrow import get as arrow_get +from rich import print from voting import Quorum, QuorumKind, Result, Voting, Vote from voting.storage import Storage diff --git a/voting/voting.py b/voting/voting.py index 7598341..fc7db01 100644 --- a/voting/voting.py +++ b/voting/voting.py @@ -98,8 +98,12 @@ class Result: out = [] if self.voting.quorum.kind != QuorumKind.NONE: out.append(f"QUORUM: {self.voting.quorum.value}{'%' if self.voting.quorum.kind == QuorumKind.PERCENT else ''}") - out.append(f"GESAMT: {len(self.voting.votes)} => DAFUER: {votes[Vote.JA.name]} DAGEGEN: {votes[Vote.NEIN.name]} ENTHALTUNGEN: {votes[Vote.ENTHALTUNG.name]}") - out.append(f"ERGEBNIS: {self.outcome()}") + out.append(f"GESAMTZAHL DER STIMMEN: {len(self.voting.votes)}/{len(self.voting.voters)}") + out.append(f"=> DAFUER: {votes[Vote.JA.name]}") + out.append(f"=> DAGEGEN: {votes[Vote.NEIN.name]}") + out.append(f"=> ENTHALTUNGEN: {votes[Vote.ENTHALTUNG.name]}") + out.append(f"=> ANTRAG: {self.outcome()}") + out.append(f"NICHT TEILGENOMMEN: {', '.join([v for v in self.voting.voters if v not in self.voting.votes])}") return '\n'.join(out) @abc.abstractmethod