class ActiveRecall::Item

Public Class Methods

expired(current_time: Time.current) click to toggle source
# File lib/active_recall/models/item.rb, line 12
def self.expired(current_time: Time.current)
  where(['box > ? and next_review <= ?', 0, current_time])
end
known(current_time: Time.current) click to toggle source
# File lib/active_recall/models/item.rb, line 16
def self.known(current_time: Time.current)
  where(['box > ? and next_review > ?', 0, current_time])
end

Public Instance Methods

right!() click to toggle source
# File lib/active_recall/models/item.rb, line 24
def right!
  update!(algorithm_class.right(**scoring_attributes))
end
source() click to toggle source
# File lib/active_recall/models/item.rb, line 20
def source
  source_type.constantize.find(source_id)
end
wrong!() click to toggle source
# File lib/active_recall/models/item.rb, line 28
def wrong!
  update!(algorithm_class.wrong(**scoring_attributes))
end

Private Instance Methods

algorithm_class() click to toggle source
# File lib/active_recall/models/item.rb, line 34
def algorithm_class
  ActiveRecall.configuration.algorithm_class
end
scoring_attributes() click to toggle source
# File lib/active_recall/models/item.rb, line 38
def scoring_attributes
  attributes.symbolize_keys.slice(:box, :times_right, :times_wrong)
end