Fixer Timer.stop method to respect custom end argument.

This commit is contained in:
Christopher Charbonneau Wells 2017-09-09 13:00:13 -04:00
parent c38290838b
commit 99dcb1e7ca
2 changed files with 7 additions and 5 deletions

View File

@ -182,7 +182,7 @@ class Timer(models.Model):
def stop(self, end=None): def stop(self, end=None):
"""Stop the timer.""" """Stop the timer."""
if not self.end: if not self.end:
self.end = timezone.now() end = timezone.now()
self.end = end self.end = end
self.save() self.save()

View File

@ -48,14 +48,16 @@
role="button"><i class="fa fa-trash" aria-hidden="true"></i></a> role="button"><i class="fa fa-trash" aria-hidden="true"></i></a>
{% endif %} {% endif %}
{% if object.active and perms.core.change_timer %} {% if perms.core.change_timer %}
<a class="btn btn-secondary" <a class="btn btn-secondary"
href="{% url 'timer-restart' timer.id %}" href="{% url 'timer-restart' timer.id %}"
role="button"><i class="fa fa-refresh" aria-hidden="true"></i></a> role="button"><i class="fa fa-refresh" aria-hidden="true"></i></a>
<a class="btn btn-warning" {% if object.active %}
href="{% url 'timer-stop' timer.id %}" <a class="btn btn-warning"
role="button"><i class="fa fa-stop" aria-hidden="true"></i></a> href="{% url 'timer-stop' timer.id %}"
role="button"><i class="fa fa-stop" aria-hidden="true"></i></a>
{% endif %}
{% endif %} {% endif %}
</div> </div>