PATCH ActiveRecord::Calculations returns incorrect data when grouping by multiple fields

Hi,

I'm looking for some feedback on a patch to fix AR calculations
with :group option that have multiple fields. This fix would be quite
useful for the rails reporting applications I have built. I submitted
a patch to lighthouse:
https://rails.lighthouseapp.com/projects/8994/tickets/5182-activerecordcalculations-returns-incorrect-data-when-grouping-by-multiple-fields#ticket-5182-2
. Any feedback would be appreciated.

Thanks,
Alex