Class: SeatPool

Inherits:
Object
  • Object
show all
Includes:
DataFactory, DateFactory, Foundry, StringFactory, Workflows
Defined in:
lib/sambal-kuali/data_objects/activity_offering.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Workflows

#go_to_academic_calendar, #go_to_calendar_search, #go_to_create_course_offerings, #go_to_create_population, #go_to_display_schedule_of_classes, #go_to_holiday_calendar, #go_to_manage_course_offerings, #go_to_manage_population, #go_to_perform_rollover, #go_to_rollover_details, #log_in, #logged_in_user

Constructor Details

#initialize(browser, opts = {}) ⇒ SeatPool

Returns a new instance of SeatPool.



277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/sambal-kuali/data_objects/activity_offering.rb', line 277

def initialize(browser, opts={})
  @browser = browser

  defaults = {
      :priority => 1,
      :seats => 10,
      :population_name => "random",
      :expiration_milestone => "First Day of Classes",
      :remove => false,
      :priority_after_reseq => 0,
      :exp_add_succeed => true
  }
  options = defaults.merge(opts)
  options[:priority_after_reseq] = options[:priority] unless options[:priority_after_reseq] != 0
  set_options(options)

end

Instance Attribute Details

#exp_add_succeedObject Also known as: exp_add_succeed?

Returns the value of attribute exp_add_succeed.



266
267
268
# File 'lib/sambal-kuali/data_objects/activity_offering.rb', line 266

def exp_add_succeed
  @exp_add_succeed
end

#expiration_milestoneObject

Returns the value of attribute expiration_milestone.



266
267
268
# File 'lib/sambal-kuali/data_objects/activity_offering.rb', line 266

def expiration_milestone
  @expiration_milestone
end

#population_nameObject

Returns the value of attribute population_name.



266
267
268
# File 'lib/sambal-kuali/data_objects/activity_offering.rb', line 266

def population_name
  @population_name
end

#priorityObject

Returns the value of attribute priority.



266
267
268
# File 'lib/sambal-kuali/data_objects/activity_offering.rb', line 266

def priority
  @priority
end

#priority_after_reseqObject

Returns the value of attribute priority_after_reseq.



266
267
268
# File 'lib/sambal-kuali/data_objects/activity_offering.rb', line 266

def priority_after_reseq
  @priority_after_reseq
end

#removeObject Also known as: remove?

Returns the value of attribute remove.



266
267
268
# File 'lib/sambal-kuali/data_objects/activity_offering.rb', line 266

def remove
  @remove
end

#seatsObject

Returns the value of attribute seats.



266
267
268
# File 'lib/sambal-kuali/data_objects/activity_offering.rb', line 266

def seats
  @seats
end

Instance Method Details

#add_seatpoolObject



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/sambal-kuali/data_objects/activity_offering.rb', line 299

def add_seatpool
  on ActivityOfferingMaintenance do |page|
    page.add_pool_priority.set @priority
    page.add_pool_seats.set @seats
    if @population_name != ""
      page.lookup_population_name

      #TODO should really call Population.search_for_pop
      on ActivePopulationLookup do |page|
        if @population_name == "random"
          page.keyword.wait_until_present
          #page.keyword.set random_letters(1)
          page.search
          page.change_results_page(1+rand(3))
          names = page.results_list
          @population_name = names[1+rand(9)]
          page.return_value @population_name
        else
          page.keyword.set @population_name
          page.search
          page.return_value @population_name
        end
      end

    end
    on ActivityOfferingMaintenance do |page|
      page.add_seat_pool
    end
  end
end

#percent_of_total(max_enrollment) ⇒ Object



295
296
297
# File 'lib/sambal-kuali/data_objects/activity_offering.rb', line 295

def percent_of_total(max_enrollment)
  "#{(@seats.to_i*100/max_enrollment.to_i).round(0)}%"
end