From d97a2498b8ba12b7be0c97a27082d44f2fd73a31 Mon Sep 17 00:00:00 2001 From: anthony Date: Tue, 19 Dec 2017 04:35:02 +0300 Subject: [PATCH] project render fix --- scripts/deploy/version.txt | 2 +- services/state_service.py | 2 +- utils/view_utils.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/deploy/version.txt b/scripts/deploy/version.txt index 3c03207..209e3ef 100644 --- a/scripts/deploy/version.txt +++ b/scripts/deploy/version.txt @@ -1 +1 @@ -18 +20 diff --git a/services/state_service.py b/services/state_service.py index 75b78b8..a754e5b 100644 --- a/services/state_service.py +++ b/services/state_service.py @@ -53,7 +53,7 @@ def start_state(bot, update, context): welcome_text = concat_username(emoji_rocket + '*', user, ', ' + message_source[lang]['state.start_state.welcome']) num_all, num_upcoming, num_completed = task_service.find_stats_for_user(chat_id) - bot_ver = 18 # because why not? :) + bot_ver = 19 # because why not? :) completed_percent = 0 if 0 == num_all else int(num_completed / num_all * 100) num_completed = f'{num_completed} ({completed_percent} %)' num_upcoming = f'{num_upcoming} ({0 if 0 == num_all else (100 - completed_percent)} %)' diff --git a/utils/view_utils.py b/utils/view_utils.py index a3bf285..89d7a46 100644 --- a/utils/view_utils.py +++ b/utils/view_utils.py @@ -16,7 +16,7 @@ emoji_mortal_reminder = ':alarm_clock: ' -def render_task(task, project, lang): +def render_task(task, lang): if task is None: raise AssertionError('Task is None') @@ -24,6 +24,7 @@ def render_task(task, project, lang): if not task.is_task_completed(): pretty_task = '*' + task.get_description() + '*' + project = project_service.find_project_by_id(task.get_project_id()) category = message_source[lang][f'btn.new_task.project.{project.get_title()}.label'] return pretty_task + ' (' + category + ') ' @@ -42,8 +43,7 @@ def render_task_with_timedelta(task, another_task, lang): if timedelta < datetime.timedelta(0): timedelta = datetime.timedelta(hours=24) - timedelta - project = project_service.find_project_by_id(task.get_project_id()) - pretty_print = render_task(another_task, project, lang) + pretty_print = render_task(another_task, lang) if timedelta: hours = timedelta.seconds // 3600 if 1 == hours: