From 5d27ef24cebd27fc26aca9e49e4c33ce6552de96 Mon Sep 17 00:00:00 2001
From: Astor Bizard <astor.bizard@grenoble-inp.fr>
Date: Thu, 19 Mar 2020 15:33:49 +0100
Subject: [PATCH] Adjusted daily activity graph time span.

---
 views/vpl_grapher.class.php | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/views/vpl_grapher.class.php b/views/vpl_grapher.class.php
index 8c739670..5268a72b 100644
--- a/views/vpl_grapher.class.php
+++ b/views/vpl_grapher.class.php
@@ -339,11 +339,14 @@ class vpl_grapher {
         }
         $start = vpl_timestamp_to_midnight($start);
 
-        // End of time span is either module due date, either now.
+        // End of time span is either module due date, either last submission date.
         if ($this->vpl->get_instance()->duedate > 0) {
             $end = $this->vpl->get_instance()->duedate;
         } else {
-            $end = time();
+            $end = 0;
+            foreach ($this->submissions as $subinstance) {
+                $end = max($end, $subinstance->datesubmitted);
+            }
         }
         $end = vpl_timestamp_to_midnight($end);
 
-- 
GitLab