Add time to task finish

This commit is contained in:
Anton Vakhrushev 2019-10-08 17:14:19 +03:00
parent acba0b2328
commit b2038dcc69
2 changed files with 10 additions and 3 deletions

View File

@ -10,8 +10,8 @@
## Управление ## Управление
- [x] Цикл ввода-вывода - [x] Цикл ввода-вывода
- [ ] Просмотр задач в очереди - [x] Просмотр задач в очереди
- [ ] Время завершения задачи при создании - [x] Время завершения задачи при создании
- [x] Сообщение о выйгрыше - [x] Сообщение о выйгрыше
## Механики ## Механики

View File

@ -85,8 +85,15 @@ def render_commands(world)
if items.size != 0 if items.size != 0
printf "Queue:\n" printf "Queue:\n"
end end
wts = world.ts
items.each do |i| items.each do |i|
printf " %s, %s\n", render_time(i.ts), i.command.desc ts_diff = i.ts - wts
if ts_diff < 60
done_time = sprintf " %02ds", ts_diff
else
done_time = sprintf "%d:%02d", ts_diff // 60, ts_diff % 60
end
printf " %s, %s, %s\n", render_time(i.ts), done_time, i.command.desc
end end
end end