From d540b2076a9e7059f6bdbbb258d6ab2bf05094ed Mon Sep 17 00:00:00 2001 From: Avin Hurry Date: Mon, 8 Jul 2024 14:58:43 +0100 Subject: [PATCH] [1980] Set personal_qualities and other_requirements to nil during rollover --- .../enrichments/copy_to_course_service.rb | 6 ++---- .../enrichments/copy_to_course_service_spec.rb | 18 ++---------------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/app/services/enrichments/copy_to_course_service.rb b/app/services/enrichments/copy_to_course_service.rb index d99366093d..bb14790b0a 100644 --- a/app/services/enrichments/copy_to_course_service.rb +++ b/app/services/enrichments/copy_to_course_service.rb @@ -4,10 +4,8 @@ module Enrichments class CopyToCourseService def execute(enrichment:, new_course:) new_enrichment = enrichment.dup - new_json_data = new_enrichment.json_data.dup - new_json_data.delete('PersonalQualities') - new_json_data.delete('OtherRequirements') - new_enrichment.json_data = new_json_data + new_enrichment.personal_qualities = nil + new_enrichment.other_requirements = nil new_enrichment.last_published_timestamp_utc = nil new_enrichment.rolled_over! new_course.enrichments << new_enrichment diff --git a/spec/services/enrichments/copy_to_course_service_spec.rb b/spec/services/enrichments/copy_to_course_service_spec.rb index 96ba953130..c9e28309c6 100644 --- a/spec/services/enrichments/copy_to_course_service_spec.rb +++ b/spec/services/enrichments/copy_to_course_service_spec.rb @@ -27,22 +27,8 @@ its(:about_course) { is_expected.to eq published_enrichment.about_course } its(:last_published_timestamp_utc) { is_expected.to be_nil } + its(:other_requirements) { is_expected.to be_nil } + its(:personal_qualities) { is_expected.to be_nil } it { is_expected.to be_rolled_over } - - it 'removes PersonalQualities from the json_data' do - expect(subject.json_data).not_to have_key('PersonalQualities') - end - - it 'removes OtherRequirements from the json_data' do - expect(subject.json_data).not_to have_key('OtherRequirements') - end - - it 'sets other_requirements to nil' do - expect(subject.other_requirements).to be_nil - end - - it 'sets personal_qualities to nil' do - expect(subject.personal_qualities).to be_nil - end end end