MDL-47377 core_grades: Handle items with a weight of 0

They do not contribute to the category/course total any more.

Part of: MDL-46576
MDL-47377 core_grades: Behat test to cover 0 weights