The page should not show any headings which don't have any
winning investments. The "no content" message should only be
shown when there are no headings with investments to avoid an
otherwise blank page.
__Note:__ in the main @headings query, _both_ #includes and #joins
are needed to:
1. eager load all necessary data (#includes)
and
2. to perform an INNER JOIN on milestones to filter out investments
with no milestones (#joins).
This commit makes 3 changes:
1. Extracts a query into a helper for clarity and DRYness
2. Adds a `.where` clause to filter investments based on their
(current) milestone status
3. Fixes a bug where investments would be rendered as many times as
milestones associated to an investment