public static function require_gradebook_backup($courseid, $backupid) {
        global $DB;

        $sql = "SELECT count(id)
                  FROM {grade_items}
                 WHERE courseid=:courseid
                   AND itemtype = 'mod'
                   AND id NOT IN (
                       SELECT bi.itemid
                         FROM {backup_ids_temp} bi
                        WHERE bi.itemname = 'grade_itemfinal'
                          AND bi.backupid = :backupid)";
        $params = array('courseid'=>$courseid, 'backupid'=>$backupid);


        $count = $DB->count_records_sql($sql, $params);

        //if there are 0 activity grade items not already included in the backup
        return $count == 0;
    }