Class: Osm::Register::Attendance
Instance Attribute Summary collapse
-
#attendance ⇒ Hash
The data for each field - keys are the date, values one of :yes, :unadvised_absent or :advised_absent.
-
#first_name ⇒ String
The member’s first name.
-
#grouping_id ⇒ Fixnum
The OSM ID for the member’s grouping.
-
#last_name ⇒ String
The member’s last name.
-
#member_id ⇒ Fixnum
The OSM ID for the member.
-
#section_id ⇒ Fixnum
The OSM ID for the member’s section.
-
#total ⇒ FixNum
Total.
Instance Method Summary collapse
-
#<=>(another) ⇒ Object
Compare Attendance based on section_id, grouping_id, last_name then first_name.
-
#absent_on?(date) ⇒ Boolean
Find out if the member was absent on a date.
-
#initialize ⇒ Object
constructor
Initialize a new registerData.
-
#present_on?(date) ⇒ Boolean
Find out if the member was present on a date.
Methods inherited from Model
#<, #<=, #>, #>=, #between?, #changed_attributes, configure, #reset_changed_attributes, #to_i
Constructor Details
#initialize ⇒ Object
Initialize a new registerData
|
# File 'lib/osm/register.rb', line 206
|
Instance Attribute Details
#attendance ⇒ Hash
Returns The data for each field - keys are the date, values one of :yes, :unadvised_absent or :advised_absent.
186 |
# File 'lib/osm/register.rb', line 186 attribute :member_id, :type => Integer |
#first_name ⇒ String
Returns The member’s first name.
186 |
# File 'lib/osm/register.rb', line 186 attribute :member_id, :type => Integer |
#grouping_id ⇒ Fixnum
Returns The OSM ID for the member’s grouping.
186 |
# File 'lib/osm/register.rb', line 186 attribute :member_id, :type => Integer |
#last_name ⇒ String
Returns The member’s last name.
186 |
# File 'lib/osm/register.rb', line 186 attribute :member_id, :type => Integer |
#member_id ⇒ Fixnum
Returns The OSM ID for the member.
186 |
# File 'lib/osm/register.rb', line 186 attribute :member_id, :type => Integer |
#section_id ⇒ Fixnum
Returns The OSM ID for the member’s section.
186 |
# File 'lib/osm/register.rb', line 186 attribute :member_id, :type => Integer |
#total ⇒ FixNum
Returns Total.
186 |
# File 'lib/osm/register.rb', line 186 attribute :member_id, :type => Integer |
Instance Method Details
#<=>(another) ⇒ Object
Compare Attendance based on section_id, grouping_id, last_name then first_name
227 228 229 230 231 232 233 |
# File 'lib/osm/register.rb', line 227 def <=>(another) result = self.section_id <=> another.try(:section_id) result = self.grouping_id <=> another.try(:grouping_id) if result == 0 result = self.last_name <=> another.try(:last_name) if result == 0 result = self.first_name <=> another.try(:last_name) if result == 0 return result end |
#absent_on?(date) ⇒ Boolean
Find out if the member was absent on a date
221 222 223 |
# File 'lib/osm/register.rb', line 221 def absent_on?(date) attendance[date] != :yes end |
#present_on?(date) ⇒ Boolean
Find out if the member was present on a date
214 215 216 |
# File 'lib/osm/register.rb', line 214 def present_on?(date) attendance[date] == :yes end |