Log Message:
-----------
Added a line that prevents errors when one of the moodle courses is no longer available.
The grade transfer process is skipped in this case.
Modified Files:
--------------
wwmoodle/wwassignment4/moodle/mod/wwassignment:
lib.php
Revision Data
-------------
Index: lib.php
===================================================================
RCS file: /webwork/cvs/system/wwmoodle/wwassignment4/moodle/mod/wwassignment/lib.php,v
retrieving revision 1.16
retrieving revision 1.17
diff -Lwwassignment4/moodle/mod/wwassignment/lib.php -Lwwassignment4/moodle/mod/wwassignment/lib.php -u -r1.16 -r1.17
--- wwassignment4/moodle/mod/wwassignment/lib.php
+++ wwassignment4/moodle/mod/wwassignment/lib.php
@@ -191,7 +191,13 @@
$courseid = $wwassignment->course;
$wwclient = new wwassignment_client();
$wwcoursename = _wwassignment_mapped_course($courseid,false);
+ if ($wwcoursename == -1 ) { // possibly the course connection to webwork has disappeared
+ return(array());
+ }
$wwsetname = $wwassignment->webwork_set;
+ if ($wwsetname == -1) {// possibly the set in webwork has disappeared
+ return(array());
+ }
$usernamearray = array();
$students = array();
$studentgrades = array();
@@ -518,7 +524,10 @@
// $modinfo = get_fast_modinfo($course);
//
-function wwassignment_update_dirty_sets() { // update grades for all instances which have been modified since last cronjob
+function wwassignment_update_dirty_sets() {
+ // update grades for all instances which have been touched since last cronjob
+ // we don't want to be checking courses from previous semesters which are dormant.
+ // we look at the log records to see if this course has been active
global $CFG;
$timenow = time();
$lastcron = get_field("modules","lastcron","name","wwassignment");
@@ -544,7 +553,7 @@
$idValues= "( ".implode(",", array_keys($wwmodtimes) ). " )";
error_log("values string $idValues");
- //error_log("last modification times".print_r($wwmodtimes,true));
+ error_log("last modification times".print_r($wwmodtimes,true));
$sql = "SELECT a.*, cm.idnumber as cmidnumber, a.course as courseid, cm.id as wwinstanceid
FROM {$CFG->prefix}wwassignment a, {$CFG->prefix}course_modules cm, {$CFG->prefix}modules m
@@ -565,8 +574,10 @@
", lastcron $lastcron, course id ".$wwassignment->course.", wwassignment id ".$wwassignment->id.
", set name ".$wwassignment->name.", cm.id ".$wwassignment->wwinstanceid);
if ($wwassignment->grade != 0) {
+ debugLog("call wwassignment_update_grades");
wwassignment_update_grades($wwassignment);
} else {
+ debugLog("call wwassignment_grade_item_update");
wwassignment_grade_item_update($wwassignment);
}
// refresh events for this assignment
|