Module: ActsAsLearnable::InstanceMethods

Defined in:
lib/acts_as_learnable/base.rb

Instance Method Summary collapse

Instance Method Details

#due_today?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/acts_as_learnable/base.rb', line 39

def due_today?
  due.nil? || due <= Date.today
end

#review(recall_quality) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/acts_as_learnable/base.rb', line 17

def review(recall_quality)
  fail unless (1..5).include?(recall_quality)

  # If the quality of response was lower than 3, then start repetitions from the beginning
  reset and return if recall_quality <= 2

  # Calculate new easiness factor
  update_easiness_factor(recall_quality)

  # Repeat all items that scored below 4
  if recall_quality == 3
    self.interval = 0
  else
    # Otherwise, increment repetitions count and set new interval
    self.repetitions += 1
    update_interval
  end

  schedule_repetition
  save
end