Module: LUSIAlmaCourseLoader::CLI::Extractors

Included in:
CourseLoader
Defined in:
lib/lusi_alma_course_loader/cli/course_loader.rb

Overview

Field extractors for LUSI course objects

Constant Summary collapse

EXTRACTORS =

Named field value extractors

{
  accessdate: proc do |_year, course, _cohort|
    date_to_s(course.student_access_date)
  end,
  accessdateutc: proc do |_year, course, _cohort|
    date_to_s(course.student_access_date_utc)
  end,
  conv: proc do |_year, course, _cohort|
    course.is_conversion_space.to_s
  end,
  copy: proc do |_year, course, _cohort|
    course.copy_course_materials_from_prev_session.to_s
  end,
  coursetype: proc { |_year, course, _cohort| course.course_type },
  createspacedate: proc do |_year, course, _cohort|
    date_to_s(course.create_space_date)
  end,
  createspacedateutc: proc do |_year, course, _cohort|
    date_to_s(course.create_space_date_utc)
  end,
  enddate: proc do |_year, _course, cohort|
    date_to_s(cohort.end_date)
  end,
  enddateutc: proc do |_year, _course, cohort|
    date_to_s(cohort.end_date_utc)
  end,
  hide: proc do |_year, course, _cohort|
    course.hide_content_on_rollover.to_s
  end,
  longtitle: proc { |_year, course, _cohort| course.display_long_title },
  shorttitle: proc do |_year, course, _cohort|
    course.display_short_title
  end,
  spacetype: proc { |_year, course, _cohort| course.space_type },
  startdate: proc do |_year, _course, cohort|
    date_to_s(cohort.start_date)
  end,
  startdateutc: proc do |_year, _course, cohort|
    date_to_s(cohort.start_date_utc)
  end,
  status: proc { |_year, course, _cohort| course.status },
  vlespaceid: proc { |_year, course, _cohort| course.lusi_vle_space_id },
  year: proc { |_year, course, _cohort| course.lusi_year_id }
}.freeze
EXTRACTOR_DETAILS =
{
  accessdate: 'start date of student access (local time)',
  accessdateutc: 'start date of student access (UTC)',
  conv: '"true" for conversion spaces, else "false"',
  copy: '"true" if copied from previous space, else "false"',
  coursetype: 'CMOD=course module, SOS=scheme of study',
  createdate: 'creation date of VLE space (local time)',
  createdateutc: 'creation date of VLE space (UTC)',
  enddate: 'end of course date (local time)',
  enddateutc: 'end of course date (UTC)',
  hide: '"true" if content hidden on rollover, else "false"',
  longtitle: 'VLE space long title',
  shorttitle: 'VLE space short title',
  spacetype: 'SHARED=shared VLE space, SINGLE=single VLE space',
  startdate: 'start of course date (local time)',
  startdateutc: 'start of course date (UTC)',
  vlespaceid: 'LUSI VLE space identity',
  year: 'LUSI year identity'
}.freeze

Class Method Summary collapse

Class Method Details

.date_to_s(date) ⇒ Object

Convert



14
15
16
# File 'lib/lusi_alma_course_loader/cli/course_loader.rb', line 14

def self.date_to_s(date)
  date.strftime('%Y-%m-%dT%H:%M:%S')
end