@@ -28,6 +28,7 @@ def exec(filename:, book_uuid:)
2828
2929 pre_or_post_index = nil
3030
31+ ancillary_index = nil
3132 teks_index = nil
3233 machine_teks_index = nil
3334
@@ -69,7 +70,11 @@ def exec(filename:, book_uuid:)
6970 end
7071 raise ArgumentError , 'Could not find "Question Stem" column' if question_stem_index . nil?
7172
72- uuid_index ||= headers . index { |header | header &.end_with? ( 'uuid' ) && !header . include? ( 'book' ) }
73+ uuid_index ||= headers . index do |header |
74+ header &.end_with? ( 'uuid' ) && (
75+ header == 'uuid' || header . start_with? ( 'page' ) || header . start_with? ( 'section' )
76+ )
77+ end
7378 section_index ||= headers . index do |header |
7479 header &.start_with? ( 'section' ) && !header . include? ( 'uuid' ) && !header . include? ( 'name' )
7580 end
@@ -87,6 +92,8 @@ def exec(filename:, book_uuid:)
8792 pre_or_post_index ||= headers . index { |header | header &.start_with? ( 'pre' ) && header . end_with? ( 'post' ) }
8893 Rails . logger . warn { 'Could not find "Pre or Post" column' } if pre_or_post_index . nil?
8994
95+ ancillary_index ||= headers . index { |header | header &.start_with? ( 'ancillary' ) }
96+
9097 teks_index ||= headers . index { |header | header &.include? ( 'teks' ) && !header . include? ( 'machine' ) }
9198 machine_teks_index ||= headers . index { |header | header &.include? ( 'machine' ) && header . include? ( 'teks' ) }
9299
@@ -144,6 +151,9 @@ def exec(filename:, book_uuid:)
144151 unless pre_or_post_index . nil? || row [ pre_or_post_index ] . blank?
145152 end
146153
154+ exercise . tags << "assessment:practice:https://openstax.org/orn/ancillary/#{ row [ ancillary_index ] } " \
155+ unless ancillary_index . nil? || row [ ancillary_index ] . blank?
156+
147157 unless teks_index . nil? || row [ teks_index ] . blank?
148158 teks = row [ teks_index ] . split ( /,|;/ ) . map ( &:strip )
149159 teks . each { |tek | exercise . tags << "teks:#{ tek } " }
0 commit comments