Fix booth recounts poll stats discrepancies
Due to technical issues, sometimes users voted in booths and their vote couldn't be added to the database. So we're including them in the users with no demographic data.
This commit is contained in:
@@ -89,6 +89,10 @@ class Poll::Stats
|
||||
end
|
||||
end
|
||||
|
||||
def total_no_demographic_data
|
||||
super + total_unregistered_booth
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def participant_ids
|
||||
@@ -103,6 +107,14 @@ class Poll::Stats
|
||||
@recounts ||= poll.recounts
|
||||
end
|
||||
|
||||
def total_registered_booth
|
||||
voters.where(origin: "booth").count
|
||||
end
|
||||
|
||||
def total_unregistered_booth
|
||||
[total_participants_booth - total_registered_booth, 0].max
|
||||
end
|
||||
|
||||
stats_cache(*stats_methods)
|
||||
|
||||
def stats_cache(key, &block)
|
||||
|
||||
Reference in New Issue
Block a user