mirror of
https://github.com/moodle/moodle.git
synced 2025-08-03 16:13:28 +02:00
MDL-27625 rating - consider RATING_UNSET_RATING a valid rating value
This commit is contained in:
parent
d04f7fb4a8
commit
5693d56cd8
3 changed files with 21 additions and 6 deletions
|
@ -1420,9 +1420,14 @@ function data_rating_validate($params) {
|
|||
}
|
||||
|
||||
//check that the submitted rating is valid for the scale
|
||||
if ($params['rating'] < 0) {
|
||||
|
||||
// lower limit
|
||||
if ($params['rating'] < 0 && $params['rating'] != RATING_UNSET_RATING) {
|
||||
throw new rating_exception('invalidnum');
|
||||
} else if ($info->scale < 0) {
|
||||
}
|
||||
|
||||
// upper limit
|
||||
if ($info->scale < 0) {
|
||||
//its a custom scale
|
||||
$scalerecord = $DB->get_record('scale', array('id' => -$params['scaleid']));
|
||||
if ($scalerecord) {
|
||||
|
|
|
@ -3513,9 +3513,14 @@ function forum_rating_validate($params) {
|
|||
}
|
||||
|
||||
//check that the submitted rating is valid for the scale
|
||||
if ($params['rating'] < 0) {
|
||||
|
||||
// lower limit
|
||||
if ($params['rating'] < 0 && $params['rating'] != RATING_UNSET_RATING) {
|
||||
throw new rating_exception('invalidnum');
|
||||
} else if ($info->scale < 0) {
|
||||
}
|
||||
|
||||
// upper limit
|
||||
if ($info->scale < 0) {
|
||||
//its a custom scale
|
||||
$scalerecord = $DB->get_record('scale', array('id' => -$params['scaleid']));
|
||||
if ($scalerecord) {
|
||||
|
|
|
@ -526,9 +526,14 @@ function glossary_rating_validate($params) {
|
|||
}
|
||||
|
||||
//check that the submitted rating is valid for the scale
|
||||
if ($params['rating'] < 0) {
|
||||
|
||||
// lower limit
|
||||
if ($params['rating'] < 0 && $params['rating'] != RATING_UNSET_RATING) {
|
||||
throw new rating_exception('invalidnum');
|
||||
} else if ($info->scale < 0) {
|
||||
}
|
||||
|
||||
// upper limit
|
||||
if ($info->scale < 0) {
|
||||
//its a custom scale
|
||||
$scalerecord = $DB->get_record('scale', array('id' => -$params['scaleid']));
|
||||
if ($scalerecord) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue