Re-engineered getActiveProposalsInContestPhase() with custom sql