Skip Orphans in Split


PR: https://github.com/edx/edx-platform/pull/10994


Ever tired of Orphans and their mess? 

We came up with a solution to long standing issue with orphans in get_items method in split mongo modulestore. We added an optional argument `include_orphans` in get_items method to either include orphans or not. 


The definition of an orphan is a block that exists in the course block list but not in the course tree.

The idea was that we should only return those items which are in course tree or are direct root items ( just like course, about or other detached categories). We do this by checking if an item has path to root item (course) or if they are top-level/ detached block types ( like about, course-info etc.) and return those items which satisfy the above constraint. Thus, helping us to not fetch orphans in this way.

Now if you pass `include_orphans=False` argument in get_items method then it will not fetch any orphans if present, it will only return those items which are actually present in the course tree .

The get_items method will behave exactly as it was behaving previously if `include_orphans` argument is not provided.

By default, `include_orphans=True`, so this will behave exactly as it was behaving earlier So if we don't want orphans, we just call get_items with `include_orphans=False`.  

Note that this will only work for split modulestore, and it will not have any impact on mongo.