MDL-55360 workshop: Emptying grades to pass should set them to zero
authorDavid Mudrák <david@moodle.com>
Wed, 27 Jul 2016 14:22:12 +0000 (16:22 +0200)
committerDavid Mudrák <david@moodle.com>
Thu, 28 Jul 2016 07:54:43 +0000 (09:54 +0200)
commit3c4cc10effd166d4aad5bf1e46923d4a4cf5c16e
tree37ccf8cb761775b2bb92c0071b3209ebc2249a11
parentebf0598e21e4aeea469df072192f31a8b9a3a9e2
MDL-55360 workshop: Emptying grades to pass should set them to zero

When editing existing workshop with a grade to pass defined, when the
field is emptied, it should be interpreted as setting it to zero. This
was not happening because unformat_float replaces the field with null,
therefore effectively unsetting it.

By casting to float, we interpret all empty values (including null) as
zeros. This behaviour is consistent with how gradebook setup UI works.
mod/workshop/lib.php