Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-5387

Dedication time being incorrectly reported for consecutive sessions with only one log entry

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.7.1
    • Fix Version/s: None
    • Labels:
      None
    • Plugin Version:
      2.3.3
    • Affected Branches:
      MOODLE_27_STABLE

      Description

      When adding dedication time into a course level user report, the time is incorrectly calculated where you have sessions with only one log entry (i.e. consecutive $sessionstart being set), or in the case of the $log array containing two consecutive sessions at the end.

      plugin_class.php needs to be amended as at the moment, it simply adds the $previouslogtime - $sessionstart after the foreach loop which is only valid if that is <$limitinseconds.

      Also, within the loop it doesn't check for the $previouslogtime - $sessionstart being < $limitinseconds meaning that if you have consecutive log entries that are seen as new sessions, you add the gap, which is too large.

      The log time entries below will allow the issue to be reproduced (with limitinseconds set to 10*60). To be consistent with the dedication block, in cases (such as the last two log entries) where the gap > limit, half the limit time should be allocated to dedication and half 'thrown away'.

      Suggested change to the code could be along the lines of the below to fix this, although not sure if that would have other consequences?

      foreach ($logs as $log) {
      if (($log->time - $previouslogtime) > $limitinseconds ) {
      if (($previouslogtime - $sessionstart) < $limitinseconds)

      { $dedication +=$limitinseconds/2; $totaldedication +=$limitinseconds/2; }

      else

      { $dedication += $previouslogtime - $sessionstart; $totaldedication += $dedication; }


      $sessionstart = $log->time;
      }

      $previouslogtime = $log->time;
      }

      if (($previouslogtime - $sessionstart) < $limitinseconds)

      { $dedication +=$limitinseconds/2; $totaldedication +=$limitinseconds/2; }

      else

      { $dedication += $previouslogtime - $sessionstart; $totaldedication += $dedication; }

      1408641924
      1408641924
      1408641924
      1408641932
      1411800903
      1411801006
      1411801231
      1411801235
      1411801249
      1411801249
      1411801456
      1411801478
      1411801494
      1411801565
      1411801580
      1411801591
      1411801602
      1411801603
      1411802134
      1411802146
      1411802155
      1411802182
      1411802277
      1411802277
      1411802357
      1411802375
      1411802385
      1411802399
      1411802430
      1411802439
      1411802445
      1411802445
      1411802984
      1411811962
      1411811978
      1411812003
      1411828702
      1413548631
      1413548649
      1413549000
      1413549007
      1413549007
      1413549066
      1413549098
      1413549399
      1413549431
      1413549695
      1414488013
      1414488019
      1414784519
      1414785763

        Attachments

          Activity

            People

            • Assignee:
              jleyva Juan Leyva
              Reporter:
              latitude91 Paul Deed
              Participants:
              Component watchers:
              Juan Leyva
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: