MDL-47763 Grades: Handle the case when a grade category is hidden.

This was breaking the contribution column, which needs to know the
weights of all the categories up the tree, whether they are visible or
not.