Skip to content

cron interval help is misleading #3

@jpeak5

Description

@jpeak5

the admin setting for cron interval has some descriptive text that I think is misleading:
Override (in hours) what a cron interval should be. Hint: zero will force every run.

The problem with this is that this value is used to determined not only when the thing runs, but also which grade items qualify for notification based on the timemodified value, creating a condition where no grade items will be selected, ie timemodified > now() AND timemodified < now()

//block_grade_notify.php:51
        $now = time();

        $runready = ($now - $lastcron) >= ($interval * 60 * 60);

        if (!$runready) {
            return false;
        }



//lib.php:92
$interval = (int)get_config('block_grade_notify', 'croninterval');
        $from = $now - ($interval * 60 * 60);


//lib.php:117
        $sql = "SELECT gg.id, gg.userid, gi.courseid, gi.itemname
                    FROM {grade_items} gi,
                         {grade_grades} gg
                    WHERE gg.userid = :userid
                    AND gi.courseid = :courseid
                    AND gg.itemid = gi.id
                    AND gi.hidden = 0
                    AND gg.hidden = 0
                    AND (gi.itemtype = 'manual' OR gi.itemtype = 'mod')
                    AND (gg.timemodified > :from AND gg.timemodified < :now)";

        $params = array(
            'userid' => $userid,
            'courseid' => $course->id,
            'now' => $now,
            'from' => $from
        );


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions