Skip to content

Commit

Permalink
project render fix
Browse files Browse the repository at this point in the history
  • Loading branch information
avbelyaev committed Dec 19, 2017
1 parent 45858c7 commit d97a249
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion scripts/deploy/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
20
2 changes: 1 addition & 1 deletion services/state_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)} %)'
Expand Down
6 changes: 3 additions & 3 deletions utils/view_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
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')

pretty_task = task.get_description()
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 + ') '

Expand All @@ -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:
Expand Down

0 comments on commit d97a249

Please sign in to comment.