mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
better bulk uploading
This commit is contained in:
parent
62a9f9c194
commit
ee44c1227c
3 changed files with 9 additions and 4 deletions
|
|
@ -79,10 +79,7 @@ class Attempt < ApplicationRecord
|
|||
|
||||
def update_counts
|
||||
return if ENV['BULK_PROCESS']
|
||||
recipient.update_attributes(
|
||||
attempts_count: recipient.attempts.count,
|
||||
responses_count: recipient.attempts.with_answer.count
|
||||
)
|
||||
recipient.update_counts
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -29,6 +29,13 @@ class Recipient < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def update_counts
|
||||
update_attributes(
|
||||
attempts_count: attempts.count,
|
||||
responses_count: attempts.with_answer.count
|
||||
)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def sync_lists
|
||||
|
|
|
|||
|
|
@ -254,5 +254,6 @@ namespace :data do
|
|||
ENV.delete('BULK_PROCESS')
|
||||
|
||||
SchoolCategory.all.each { |sc| sc.sync_aggregated_responses }
|
||||
Recipient.all.each { |r| r.update_counts }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue