summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-06-04 10:46:47 -0400
committerDavid Gay <david@davidgay.org>2021-06-04 10:46:47 -0400
commit341737fc160a77a282713e76cc6f522e36f122b5 (patch)
treef79da564a5d5c85e3a68f1b3041633c2594839cb /app
parent31cb12b7a9aee6581c21310dcf9adbf2c4c49ac4 (diff)
Don't start progress bar halfway done due to rested time
Diffstat (limited to 'app')
-rw-r--r--app/models/character.rb2
-rw-r--r--app/views/application/_timer.html.erb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/character.rb b/app/models/character.rb
index 8a72ccd..b4e597b 100644
--- a/app/models/character.rb
+++ b/app/models/character.rb
@@ -210,7 +210,7 @@ class Character < ApplicationRecord
end
def percentage_of_activity_completed
- (1 - (activity_time_remaining / activity_duration)) * 100
+ (1 - (activity_time_remaining / (activity_duration - rested_duration_to_spend_on_activity))) * 100
end
def rested_duration_to_spend_on_activity
diff --git a/app/views/application/_timer.html.erb b/app/views/application/_timer.html.erb
index 06c4dd7..ca12a77 100644
--- a/app/views/application/_timer.html.erb
+++ b/app/views/application/_timer.html.erb
@@ -2,7 +2,7 @@
<h2 class="text-lg text-display text-center"><%= current_char.activity.name %></h2>
<div data-controller="timer"
data-timer-time-remaining-value="<%= current_char.activity_time_remaining %>"
- data-timer-activity-duration-value="<%= current_char.activity_duration %>"
+ data-timer-activity-duration-value="<%= current_char.activity_duration - current_char.rested_duration_to_spend_on_activity %>"
data-timer-post-url-value="<%= finish_activity_url %>">
<div class="text-center">
<span data-timer-target="timer" class="text-xl text-display"></span>