scope include with joins. totalcount with distinct