diff --git a/app/services/imports/import_report_service.rb b/app/services/imports/import_report_service.rb index e636bee90..7dcde699c 100644 --- a/app/services/imports/import_report_service.rb +++ b/app/services/imports/import_report_service.rb @@ -96,10 +96,10 @@ module Imports if unanswered_question_counts[unanswered_questions].present? unanswered_question_counts[unanswered_questions] += 1 - missing_answers_example_sets[unanswered_questions] << { id: lettings_log.id, old_id: lettings_log.old_id, owning_organisation_id: lettings_log.owning_organisation_id } unless unanswered_question_counts[unanswered_questions] > 10 + missing_answers_example_sets[unanswered_questions] << { id: lettings_log.id, old_form_id: lettings_log.old_form_id, owning_organisation_id: lettings_log.owning_organisation_id } unless unanswered_question_counts[unanswered_questions] > 10 else unanswered_question_counts[unanswered_questions] = 1 - missing_answers_example_sets[unanswered_questions] = [{ id: lettings_log.id, old_id: lettings_log.old_id, owning_organisation_id: lettings_log.owning_organisation_id }] + missing_answers_example_sets[unanswered_questions] = [{ id: lettings_log.id, old_form_id: lettings_log.old_form_id, owning_organisation_id: lettings_log.owning_organisation_id }] end end @@ -113,12 +113,12 @@ module Imports end missing_answers_examples = CSV.generate do |report| - headers = ["Missing answers", "Organisation ID", "Log ID", "Old Log ID"] + headers = ["Missing answers", "Organisation ID", "Log ID", "Old Form ID"] report << headers missing_answers_example_sets.each do |missing_answers, examples| examples.each do |example| - report << [missing_answers, example[:owning_organisation_id], example[:id], example[:old_id]] + report << [missing_answers, example[:owning_organisation_id], example[:id], example[:old_form_id]] end end end diff --git a/spec/fixtures/files/imported_lettings_logs_missing_answers_examples.csv b/spec/fixtures/files/imported_lettings_logs_missing_answers_examples.csv index 4d6da88ab..0c35bae0b 100644 --- a/spec/fixtures/files/imported_lettings_logs_missing_answers_examples.csv +++ b/spec/fixtures/files/imported_lettings_logs_missing_answers_examples.csv @@ -1,16 +1,16 @@ -Missing answers,Organisation ID,Log ID,Old Log ID -age1_known,{org_id0},{id0},age1_known_0 -age1_known,{org_id1},{id1},age1_known_1 -age1_known,{org_id2},{id2},age1_known_2 -age1_known,{org_id3},{id3},age1_known_3 -age1_known,{org_id4},{id4},age1_known_4 -age1_known,{org_id5},{id5},age1_known_5 -age1_known,{org_id6},{id6},age1_known_6 -age1_known,{org_id7},{id7},age1_known_7 -age1_known,{org_id8},{id8},age1_known_8 -age1_known,{org_id9},{id9},age1_known_9 -beds,{org_id2_0},{id2_0},beds_0 -beds,{org_id2_1},{id2_1},beds_1 -beds,{org_id2_2},{id2_2},beds_2 -beds,{org_id2_3},{id2_3},beds_3 -"beds, age1_known",{org_id},{id},beds_and_age +Missing answers,Organisation ID,Log ID,Old Form ID +age1_known,{org_id0},{id0},1000 +age1_known,{org_id1},{id1},1001 +age1_known,{org_id2},{id2},1002 +age1_known,{org_id3},{id3},1003 +age1_known,{org_id4},{id4},1004 +age1_known,{org_id5},{id5},1005 +age1_known,{org_id6},{id6},1006 +age1_known,{org_id7},{id7},1007 +age1_known,{org_id8},{id8},1008 +age1_known,{org_id9},{id9},1009 +beds,{org_id2_0},{id2_0},2000 +beds,{org_id2_1},{id2_1},2001 +beds,{org_id2_2},{id2_2},2002 +beds,{org_id2_3},{id2_3},2003 +"beds, age1_known",{org_id},{id},300 diff --git a/spec/services/imports/import_report_service_spec.rb b/spec/services/imports/import_report_service_spec.rb index fe7384804..ca6e81bc2 100644 --- a/spec/services/imports/import_report_service_spec.rb +++ b/spec/services/imports/import_report_service_spec.rb @@ -107,18 +107,20 @@ RSpec.describe Imports::ImportReportService do before do create_list(:lettings_log, 11, :completed, age1_known: nil) do |log, i| - log.old_id = "age1_known_#{i}" + log.old_form_id = "100#{i}" + log.old_id = "old_id_age1_known_#{i}" log.save! expected__answers_examples_content.sub!("{id#{i}}", log.id.to_s) expected__answers_examples_content.sub!("{org_id#{i}}", log.owning_organisation_id.to_s) end create_list(:lettings_log, 4, :completed, beds: nil) do |log, i| - log.old_id = "beds_#{i}" + log.old_form_id = "200#{i}" + log.old_id = "old_id_beds_#{i}" expected__answers_examples_content.sub!("{id2_#{i}}", log.id.to_s) expected__answers_examples_content.sub!("{org_id2_#{i}}", log.owning_organisation_id.to_s) log.save! end - create(:lettings_log, :completed, age1_known: nil, beds: nil, old_id: "beds_and_age") do |log| + create(:lettings_log, :completed, age1_known: nil, beds: nil, old_form_id: "300", old_id: "123") do |log| expected__answers_examples_content.sub!("{id}", log.id.to_s) expected__answers_examples_content.sub!("{org_id}", log.owning_organisation_id.to_s) end