@@ -69,15 +69,17 @@ def exec(filename:, book_uuid:)
6969 end
7070 raise ArgumentError , 'Could not find "Question Stem" column' if question_stem_index . nil?
7171
72- uuid_index ||= headers . index { |header | header == 'uuid' || header == 'page uuid' }
73- section_index ||= headers . index { |header | header == 'section' }
72+ uuid_index ||= headers . index do |header |
73+ header == 'uuid' || header == 'page uuid' || header == 'section uuid'
74+ end
75+ section_index ||= headers . index { |header | header == 'section' || header == 'section number' }
7476 Rails . logger . warn { 'Could not find "UUID" or "Section" columns' } \
7577 if uuid_index . nil? && section_index . nil?
7678
7779 unless section_index . nil?
7880 book = OpenStax ::Content ::Abl . new . approved_books . find { |book | book . uuid == book_uuid }
79- book . all_pages . each { |page | page_uuid_by_book_location [ page . book_location ] = page . uuid }
8081 raise ArgumentError , "Could not find book with UUID #{ book_uuid } in the ABL" if book . nil?
82+ book . all_pages . each { |page | page_uuid_by_book_location [ page . book_location ] = page . uuid }
8183 end
8284
8385 nickname_index ||= headers . index { |header | header &.include? ( 'nickname' ) }
@@ -168,7 +170,6 @@ def exec(filename:, book_uuid:)
168170 exercise . questions << question
169171
170172 stem = Stem . new ( content : parse ( row [ question_stem_index ] , exercise ) )
171- stem . stylings << Styling . new ( style : ::Style ::MULTIPLE_CHOICE )
172173 question . stems << stem
173174
174175 unless detailed_solution_index . nil? || row [ detailed_solution_index ] . blank?
@@ -179,7 +180,12 @@ def exec(filename:, book_uuid:)
179180 question . collaborator_solutions << solution
180181 end
181182
182- next if correct_answer_index . nil? || row [ correct_answer_index ] . blank?
183+ if correct_answer_index . nil? || row [ correct_answer_index ] . blank?
184+ stem . stylings << Styling . new ( style : ::Style ::FREE_RESPONSE )
185+ next
186+ end
187+
188+ stem . stylings << Styling . new ( style : ::Style ::MULTIPLE_CHOICE )
183189
184190 correct_answer = row [ correct_answer_index ] . downcase . strip . each_byte . first - 97
185191 answer_choice_indices . each_with_index do |row_index , answer_index |
0 commit comments