Skip to content

Commit 794baa6

Browse files
committed
Don't add cnxmod tags to preparedness exercises at all
1 parent e5ba0c1 commit 794baa6

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

app/routines/exercises/import/assessments.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ def exec(filename:, book_uuid:)
145145
Rails.logger.warn { "Row ##{row_number} has no associated page in the book" } \
146146
unless uuid_index.nil? && section_index.nil?
147147
else
148-
exercise.tags << "context-cnxmod:#{page_uuid}"
149-
exercise.tags << "assessment:#{row[pre_or_post_index].downcase == 'pre' ? 'preparedness' : 'practice'
148+
is_pre = row[pre_or_post_index].downcase == 'pre'
149+
exercise.tags << "context-cnxmod:#{page_uuid}" unless is_pre
150+
exercise.tags << "assessment:#{is_pre ? 'preparedness' : 'practice'
150151
}:https://openstax.org/orn/book:page/#{book_uuid}:#{page_uuid}" \
151152
unless pre_or_post_index.nil? || row[pre_or_post_index].blank?
152153
end

app/routines/exercises/tag/assessments.rb

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ class Assessments
1515
def exec(filename:, book_uuid:)
1616
Rails.logger.info { "Filename: #{filename}" }
1717

18-
book = OpenStax::Content::Abl.new.books.find { |book| book.uuid == book_uuid }
19-
all_cnxmod_tags = book.all_pages.map { |page| "context-cnxmod:#{page.uuid}" }
20-
2118
uuid_index = nil
2219
pre_indices = nil
2320
post_indices = nil
@@ -67,18 +64,11 @@ def exec(filename:, book_uuid:)
6764
post_section_tag = "assessment:practice:https://openstax.org/orn/book:page/#{book_uuid}:#{page_uuid}"
6865
cnxmod_tag = "context-cnxmod:#{page_uuid}"
6966

70-
# Normally pre-section exercises don't get cnxmod tags,
71-
# unless they have no cnxmod tags for the entire book
72-
pre_section_ex_with_cnxmod, pre_section_ex_missing_cnxmod = pre_section_exercises.partition do |ex|
73-
ex.tags.any? { |tag| all_cnxmod_tags.include? tag.name }
74-
end
75-
7667
row_number = row_index + 1
7768

7869
begin
7970
tag pre_and_post_section_exercises, [ pre_section_tag, post_section_tag, cnxmod_tag ]
80-
tag pre_section_ex_with_cnxmod, [ pre_section_tag ]
81-
tag pre_section_ex_missing_cnxmod, [ pre_section_tag, cnxmod_tag ]
71+
tag pre_section_exercises, [ pre_section_tag ]
8272
tag post_section_exercises, [ post_section_tag, cnxmod_tag ]
8373
rescue StandardError => se
8474
Rails.logger.error { "Failed to import row ##{row_number} - #{se.message}" }

0 commit comments

Comments
 (0)