Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cron interval help is misleading #3

Open
jpeak5 opened this issue Jul 18, 2013 · 0 comments
Open

cron interval help is misleading #3

jpeak5 opened this issue Jul 18, 2013 · 0 comments

Comments

@jpeak5
Copy link
Contributor

jpeak5 commented Jul 18, 2013

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
        );


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant