MDL-38714 Lesson module: add setType for hidden and text inputs
MDL-32913 core_grade:made it more obvious when the gradebook is broken due to a broken calculation
MDL-38717: Lesson mod: fixed behat script to accomodate the fix of settype()
MDL-39450 course formats: add static cache to get_format_or_default

This function gets called hundreds of times on every page, often with
exactly the same input, so I added a static cache.
MDL-39476 Assign: Cleanup old bad data before adding new index
Merge branch 'MDL-38714_tmp' of git://github.com/rwijaya/moodle
Merge branch 'MDL-39476-master' of git://github.com/damyon/moodle
Merge branch 'brokencalc' of git://github.com/andyjdavis/moodle
Merge branch 'MDL-38041_master' of git://github.com/dmonllao/moodle
Merge branch 'MDL-39348_master' of git://github.com/dmonllao/moodle
MDL-39478 behat: New constant to detect when the test site is running

Also removing an unused var and method.