Class: ActiveRecall::Item

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/active_recall/models/item.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.expired(current_time: Time.current) ⇒ Object



12
13
14
# 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) ⇒ Object



16
17
18
# 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

Instance Method Details

#right!Object



24
25
26
# File 'lib/active_recall/models/item.rb', line 24

def right!
  update!(algorithm_class.right(**scoring_attributes))
end

#sourceObject



20
21
22
# File 'lib/active_recall/models/item.rb', line 20

def source
  source_type.constantize.find(source_id)
end

#wrong!Object



28
29
30
# File 'lib/active_recall/models/item.rb', line 28

def wrong!
  update!(algorithm_class.wrong(**scoring_attributes))
end