From e318581dd1e453a7d04d85b12796d1a2b5602907 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Sat, 12 Nov 2022 07:55:25 +0100 Subject: [PATCH] Don't break if poll doesn't have an expiry date --- toot/tui/timeline.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/toot/tui/timeline.py b/toot/tui/timeline.py index 1885c5b..8faafd4 100644 --- a/toot/tui/timeline.py +++ b/toot/tui/timeline.py @@ -334,13 +334,15 @@ class StatusDetails(urwid.Pile): yield urwid.Text(option["title"]) yield urwid.ProgressBar("", "poll_bar", perc) - if poll["expired"]: - status = "Closed" - else: - expires_at = parse_datetime(poll["expires_at"]).strftime("%Y-%m-%d %H:%M") - status = "Closes on {}".format(expires_at) + status = "Poll · {} votes".format(poll["votes_count"]) + + if poll["expired"]: + status += " · Closed" + + if poll["expires_at"]: + expires_at = parse_datetime(poll["expires_at"]).strftime("%Y-%m-%d %H:%M") + status += " · Closes on {}".format(expires_at) - status = "Poll · {} votes · {}".format(poll["votes_count"], status) yield urwid.Text(("gray", status))