Class: SpreeCmCommissioner::VoteCounters::AuditCounters
- Defined in:
- app/services/spree_cm_commissioner/vote_counters/audit_counters.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from SpreeCmCommissioner::VoteCounters::Base
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/services/spree_cm_commissioner/vote_counters/audit_counters.rb', line 11 def call db_counts = SpreeCmCommissioner::Vote.for_session(voting_session_id) .group(:contestant_id) .sum(:quantity) redis_counts = SpreeCmCommissioner::VoteCounters::PerContestantCounter.new(voting_session_id).call redis_counts.each do |contestant_id, redis_count| db_count = db_counts[contestant_id] || 0 next if redis_count == db_count CmAppLogger.log( label: 'VoteCounter mismatch', data: { voting_session_id: voting_session_id, contestant_id: contestant_id, redis_count: redis_count, db_count: db_count } ) end end |