From 31f9425f697c4138f82fb07f0db5afc9f8652c81 Mon Sep 17 00:00:00 2001 From: Reshef Date: Sun, 9 Oct 2016 15:50:27 -0400 Subject: [PATCH] implemented stray TODO for controversial time sorting --- rtv/page.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/rtv/page.py b/rtv/page.py index 3a64c11..113e721 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -124,9 +124,27 @@ class Page(object): @PageController.register(Command('SORT_CONTROVERSIAL')) def sort_content_controversial(self): - self.refresh_content(order='controversial') + if (self.content.order and 'controversial' not in self.content.order) or 'front' in self.content.name: + self.refresh_content(order='controversial') + return + else: + ch = self.term.show_notification( + docs.TIME_ORDER_MENU.strip('\n').splitlines()) + if ch not in range(ord('1'), ord('6') + 1): + self.term.show_notification('Invalid option') + return + ord_choices = { + ord('1'): 'controversial-hour', + ord('2'): 'controversial-day', + ord('3'): 'controversial-week', + ord('4'): 'controversial-month', + ord('5'): 'controversial-year', + ord('6'): 'controversial-all', + } + order = ord_choices[ch] + + self.refresh_content(order=order) - ##TODO: ADD CONTROVERSIAL SUBSORTS @PageController.register(Command('MOVE_UP')) def move_cursor_up(self):