Class: Osm::Register::Attendance

Inherits:
Model
  • Object
show all
Defined in:
lib/osm/register.rb

Constant Summary collapse

SORT_BY =
[:section_id, :grouping_id, :last_name, :first_name]

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Model

#<, #<=, #<=>, #>, #>=, #between?, #changed_attributes, configure, #reset_changed_attributes, #to_i

Constructor Details

#initializeObject

Initialize a new registerData

Parameters:

  • attributes (Hash)

    The hash of attributes (see attributes for descriptions, use Symbol of attribute name as the key)



# File 'lib/osm/register.rb', line 204

Instance Attribute Details

#attendanceHash

Returns The data for each field - keys are the date, values one of :yes, :unadvised_absent or :advised_absent.

Returns:

  • (Hash)

    The data for each field - keys are the date, values one of :yes, :unadvised_absent or :advised_absent



182
# File 'lib/osm/register.rb', line 182

attribute :member_id, :type => Integer

#first_nameString

Returns The member’s first name.

Returns:

  • (String)

    The member’s first name



182
# File 'lib/osm/register.rb', line 182

attribute :member_id, :type => Integer

#grouping_idFixnum

Returns The OSM ID for the member’s grouping.

Returns:

  • (Fixnum)

    The OSM ID for the member’s grouping



182
# File 'lib/osm/register.rb', line 182

attribute :member_id, :type => Integer

#last_nameString

Returns The member’s last name.

Returns:

  • (String)

    The member’s last name



182
# File 'lib/osm/register.rb', line 182

attribute :member_id, :type => Integer

#member_idFixnum

Returns The OSM ID for the member.

Returns:

  • (Fixnum)

    The OSM ID for the member



182
# File 'lib/osm/register.rb', line 182

attribute :member_id, :type => Integer

#section_idFixnum

Returns The OSM ID for the member’s section.

Returns:

  • (Fixnum)

    The OSM ID for the member’s section



182
# File 'lib/osm/register.rb', line 182

attribute :member_id, :type => Integer

#totalFixNum

Returns Total.

Returns:

  • (FixNum)

    Total



182
# File 'lib/osm/register.rb', line 182

attribute :member_id, :type => Integer

Instance Method Details

#absent_on?(date) ⇒ Boolean

Find out if the member was absent on a date

Parameters:

  • date (Date)

    The date to check attendance for

Returns:

  • (Boolean)

    whether the member was absent on the given date



219
220
221
# File 'lib/osm/register.rb', line 219

def absent_on?(date)
  attendance[date] != :yes
end

#present_on?(date) ⇒ Boolean

Find out if the member was present on a date

Parameters:

  • date (Date)

    The date to check attendance for

Returns:

  • (Boolean)

    whether the member was presnt on the given date



212
213
214
# File 'lib/osm/register.rb', line 212

def present_on?(date)
  attendance[date] == :yes
end