Class: JLDrill::DurationCounter

Inherits:
Counter
  • Object
show all
Defined in:
lib/jldrill/model/Quiz/Counter.rb

Instance Attribute Summary

Attributes inherited from Counter

#ranges, #table

Instance Method Summary collapse

Methods inherited from Counter

findRange, getLevel, #initialize, #initializeTable, #levelString, #makeRanges, #toDays, #to_s

Constructor Details

This class inherits a constructor from JLDrill::Counter

Instance Method Details

#count(item) ⇒ Object



80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/jldrill/model/Quiz/Counter.rb', line 80

def count(item)
    found = false
    0.upto(6) do |level|
        if !found && item.schedule.durationWithin?(@ranges[level])
            @table[level] += 1
            found = true
        end
    end
    if !found
        @table[7] += 1
    end
end