Using map to retrieve the element ids because of some issues with mysql
This commit is contained in:
parent
3dc331c613
commit
c5a89b35f0
|
@ -1,3 +1,6 @@
|
|||
# Service class for getting and caching the number of elements of several projects
|
||||
# Warning: do not user this service with a really large set of projects
|
||||
# because the service use maps to retrieve the project ids.
|
||||
module Projects
|
||||
class BatchCountService
|
||||
def initialize(projects)
|
||||
|
@ -14,8 +17,6 @@ module Projects
|
|||
end
|
||||
|
||||
def project_ids
|
||||
return @projects if @projects.is_a?(ActiveRecord::Relation)
|
||||
|
||||
@projects.map(&:id)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Service class for getting and caching the number of forks of several projects
|
||||
# Warning: do not user this service with a really large set of projects
|
||||
# because the service use maps to retrieve the project ids
|
||||
module Projects
|
||||
# Service class for getting and caching the number of forks of several projects
|
||||
class BatchForksCountService < Projects::BatchCountService
|
||||
def global_count
|
||||
@global_count ||= begin
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# Service class for getting and caching the number of issues of several projects
|
||||
# Warning: do not user this service with a really large set of projects
|
||||
# because the service use maps to retrieve the project ids
|
||||
module Projects
|
||||
# Service class for getting and caching the number of forks of several projects
|
||||
class BatchOpenIssuesCountService < Projects::BatchCountService
|
||||
def global_count
|
||||
@global_count ||= begin
|
||||
|
|
Loading…
Reference in New Issue