]> git.mjollnir.org Git - moodle.git/commitdiff
final locking API cleanup
authorskodak <skodak>
Thu, 9 Aug 2007 12:44:10 +0000 (12:44 +0000)
committerskodak <skodak>
Thu, 9 Aug 2007 12:44:10 +0000 (12:44 +0000)
lib/grade/grade_grade.php
lib/grade/grade_item.php

index ff2e4ebad90a0bd0075d5214b3d04c28553dfe8d..4c60b2c8fcef0d4886fbd38f09afe3ba44ee8d68 100644 (file)
@@ -302,37 +302,15 @@ class grade_grade extends grade_object {
         }
     }
 
-    /**
-     * Lock the grade if needed - make sure this is called only when final grade is valid
-     */
-    function check_locktime() {
-        if (!empty($this->locked)) {
-            return; // already locked - do not use is_locked() because we do not want the locking status of grade_item here
-        }
-
-        if ($this->locktime and $this->locktime < time()) {
-            $this->locked = time();
-            $this->update('locktime');
-        }
-    }
-
-
     /**
      * Lock the grade if needed - make sure this is called only when final grades are valid
      * @param int $courseid
-     * @param array $items array of all grade item ids (speedup only)
+     * @param array $items array of all grade item ids
      * @return void
      */
-    function check_locktime_all($courseid, $items=null) {
+    function check_locktime_all($courseid, $items) {
         global $CFG;
 
-        if (!$items) {
-            if (!$items = get_records('grade_items', 'courseid', $courseid, '', 'id')) {
-                return; // no items?
-            }
-            $items = array_keys($items);
-        }
-
         $items_sql = implode(',', $items);
 
         $now = time(); // no rounding needed, this is not supposed to be called every 10 seconds
index 1c8aaa804b20ca5cdc3709e1b30cc91708396212..1dcf587b9a3c320e28e2479ac9d3bc43e3822cf8 100644 (file)
@@ -493,28 +493,6 @@ class grade_item extends grade_object {
         }
     }
 
-    /**
-     * Lock all grade items if needed - make sure this is called only when final grades are valid
-     * @static
-     * @param int $courseid
-     * @return void
-     */
-    function check_locktime_all($courseid) {
-        global $CFG;
-
-        $now = time(); // no need to round it here, executed from cron only
-        $sql = "SELECT * FROM {$CFG->prefix}grade_items
-                 WHERE courseid=$courseid AND locked = 0 AND locktime > 0 AND locktime < $now";
-
-        if ($items = get_records_sql($sql)) {
-            foreach ($items as $item) {
-                $grade_item = new grade_grade($item, false);
-                $grade_item->locked = time();
-                $grade_item->update('locktime');
-            }
-        }
-    }
-
     /**
      * Set the locktime for this grade item.
      *