diff --git a/mod/hotpot/report.php b/mod/hotpot/report.php index 0dfb8deb40b..615db96dde1 100644 --- a/mod/hotpot/report.php +++ b/mod/hotpot/report.php @@ -259,9 +259,14 @@ $users[$userid]->attempts[] = &$attempts[$id]; - if ($mode=='click' && isset($cr_attempts[$id])) { - $attempts[$id]->cr_lastclick = $cr_attempts[$id]->id; - $attempts[$id]->cr_timefinish = $cr_attempts[$id]->timefinish; + if ($mode=='click') { + // shortcut to clickreportid (=the id of the FIRST attempt in this clickreport series) + $clickreportid = $attempt->clickreportid; + if (isset($cr_attempts[$clickreportid])) { + // store id and finish time of LAST attempt in this clickreport series + $attempts[$id]->cr_lastclick = $cr_attempts[$clickreportid]->id; + $attempts[$id]->cr_timefinish = $cr_attempts[$clickreportid]->timefinish; + } } }