Fixed 404 on courseware when users last visited subsection becomes unpublished.

"Page not found" if student visits courseware after the section they visited becomes unpublished.
LMS-6492
I think the if condition would be safer and easier to understand this way:
```
[child for child in child_modules if
 (child.has_children_at_depth(min_depth - 1) and len(child.get_display_items()) > 0)]
```