Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-84797

mod_goone Attempt to assign property "timecreated" on bool

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a bug
    • Icon: Minor Minor
    • None
    • 4.5.2
    • Other
    • None
    • MOODLE_405_STABLE

      The 'check_mark_completion' cron task appears to have a code error.

      When no records are returned to '$lmsviewed' it has the value 'false'.

      When the code tries to use property 'timecreated' on '$lmsviewed' it throws an error since '$lmsviewed' is a boolean not an object.

      Line 94
         //Check viewed and mark it.
         $lmsviewed = $DB->get_record('course_modules_viewed',
         ['coursemoduleid'=>$cm->id, 'userid'=>$gcrecord->userid]);
         if (empty($lmsviewed)) {
            $newviewed = new \stdClass();
            if (isset($gcrecord->timemodified) && $gcrecord->timemodified > 0) {          
            //Set timemodified from goone completion table.
      $lmsviewed->timecreated = $gcrecord->timemodified;      
            } else {          
      //Set timemodified as current timestamp as correct timemodified date not found.
      $lmsviewed->timecreated = time();      
      }

           $newviewed->timecreated = time();
           $newviewed->coursemoduleid = $cm->id;
           $newviewed->userid = $gcrecord->userid;
           $DB->insert_record('course_modules_viewed', $lmsviewed);
           goone_set_completion($cm, $gcrecord->userid, '', "completed");
         }

            Unassigned Unassigned
            khipwell Kevin Hipwell
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.