Project

General

Profile

Actions

Patch #16905

closed

Count users with a single query on group list

Added by Jérôme BATAILLE almost 10 years ago. Updated almost 7 years ago.

Status:
Closed
Priority:
Normal
Category:
Code cleanup/refactoring
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

All users are loaded for each group, only to count them !


Files

Actions #2

Updated by Jean-Philippe Lang almost 10 years ago

  • Subject changed from Admin : groups otpimization of users count to Count users with a single query on group list
  • Category changed from Groups to Code cleanup/refactoring
  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Target version set to 2.6.0

This patch didn't work for me, as the hash keys are strings (tested with postgresql):

irb(main):001:0> User.joins(:groups).group('group_id').count
=> {"98913"=>2}

Fix committed in r13149 with test.

Actions #3

Updated by Jérôme BATAILLE almost 10 years ago

Jean-Philippe, thanks to have reviewed this patch.

Actions #4

Updated by Jean-Philippe Lang over 9 years ago

  • Status changed from Resolved to Closed
Actions #5

Updated by Jérôme BATAILLE almost 7 years ago

Hi, you can indicate in the Resolution that's it's Fixed, if you have the time to, thanks a lot.

Actions #6

Updated by Toshi MARUYAMA almost 7 years ago

Jérôme BATAILLE wrote:

Hi, you can indicate in the Resolution that's it's Fixed, if you have the time to, thanks a lot.

"patch" tracker does not have "resolution" filed.

Actions

Also available in: Atom PDF