Method: Scry::Course#create_export

Defined in:
lib/scry/course.rb

#create_exportObject

Creates an export file for the course

Navigates from the course page to the export course page and creates an export for the course.

First it all existing exports, then attempts to create a new export.

It will wait a specified amount of time for the export to be created.



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/scry/course.rb', line 51

def create_export
  course_page = @agent.click(@course_link)
  package_links = course_page.links_with(
    text: /Packages & Utilities Overview Page/,
  )
  if package_links.any?
    utilities_page = click_link(
      agent: @agent,
      page: course_page,
      text: /Packages & Utilities Overview Page/,
    )
    exports_page = click_link(
      agent: @agent,
      page: utilities_page,
      text: /Export\/Archive Course/,
    )
    export_button_link = exports_page.links_with(
      text: /Export Package/,
    )
    if export_button_link.any?
      course_id =
        exports_page.form_with(name: "selectFileToDelete")["courseId"]
      _delete_existing_exports(exports_page, course_id, nil)
      export_page = click_link(
        agent: @agent,
        page: exports_page,
        text: /Export Package/,
      )
      exports_page = _process_export_form(export_page)
      exports = exports_page.links_with(
        text: "View Basic Log",
      )
      _wait_for_export(exports, utilities_page, exports_page, course_id)
    else
      write_log(
        Scry.export_generation_no_export_button,
        @course_link.href.strip,
      )
    end
  end
end