From 47b4b43384642a94522f642f8b66359b404a1270 Mon Sep 17 00:00:00 2001 From: dzhuang Date: Fri, 27 Jan 2017 00:41:47 +0800 Subject: [PATCH] Stop timer for finished sessions. --- course/flow.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/course/flow.py b/course/flow.py index e41621ca..e57807ce 100644 --- a/course/flow.py +++ b/course/flow.py @@ -1765,7 +1765,6 @@ def view_flow_page(pctx, flow_session_id, ordinal): if viewing_prior_version: from django.template import defaultfilters - from relate.utils import as_local_time messages.add_message(request, messages.INFO, _("Viewing prior submission dated %(date)s.") % { @@ -1888,8 +1887,12 @@ def view_flow_page(pctx, flow_session_id, ordinal): session_minutes = None time_factor = 1 if flow_permission.see_session_time in permissions: + if not flow_session.in_progress: + end_time = as_local_time(flow_session.completion_time) + else: + end_time = now_datetime session_minutes = ( - now_datetime - flow_session.start_time).total_seconds() / 60 + end_time - flow_session.start_time).total_seconds() / 60 if flow_session.participation is not None: time_factor = flow_session.participation.time_factor -- GitLab