Adding spec to isolate issue with conditional columns and batch queries.
Combining 'records' and 'counts' queries into one (to ensure they stay in sync).
Updating spec to isolate failing case. (Main with no matching conditional Dependents fails to update column to 0)
Fixing case where counts_query excludes rows due to 0 matches.
Move conditions into innermost JOIN (on table we are counting) so that rows that don't match condition get count of 0 instead of being filtered out of query.