Group an array by a (computed) property and reduce it