Class: Merit::Action

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
app/models/merit/action.rb,
lib/merit/models/mongoid/merit/action.rb,
lib/merit/models/active_record/merit/action.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.check_unprocessedObject


17
18
19
# File 'app/models/merit/action.rb', line 17

def self.check_unprocessed
  where(processed: false).map(&:check_all_rules)
end

Instance Method Details

#check_all_rulesObject

Check rules defined for a merit_action


22
23
24
25
26
27
28
# File 'app/models/merit/action.rb', line 22

def check_all_rules
  mark_as_processed!
  return if had_errors

  check_rules rules_matcher.select_from(AppBadgeRules), :badges
  check_rules rules_matcher.select_from(AppPointRules), :points
end