From c09d1780e1d36a0aaa2bfada2e9a21864c75cf2d Mon Sep 17 00:00:00 2001 From: Manny Dinssa <44172848+Dinssa@users.noreply.github.com> Date: Tue, 1 Apr 2025 10:51:44 +0100 Subject: [PATCH] Update app/controllers/test_data_controller.rb Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- app/controllers/test_data_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/test_data_controller.rb b/app/controllers/test_data_controller.rb index 962790524..b1b84f778 100644 --- a/app/controllers/test_data_controller.rb +++ b/app/controllers/test_data_controller.rb @@ -22,7 +22,8 @@ class TestDataController < ApplicationController return render_not_found unless FeatureToggle.create_test_logs_enabled? file = Tempfile.new("#{year}_test_lettings_log.csv") - log = FactoryBot.create(:lettings_log, :completed, assigned_to: current_user, ppostcode_full: "SW1A 1AA", startdate: generate_different_date_within_collection_year(Time.zone.now, end_date_override: Time.zone.now + 14.days)) + start_date = Time.zone.local(year.to_i, 1, 1) + log = FactoryBot.create(:lettings_log, :completed, assigned_to: current_user, ppostcode_full: "SW1A 1AA", startdate: generate_different_date_within_collection_year(start_date, end_date_override: start_date + 14.days)) log_to_csv = BulkUpload::LettingsLogToCsv.new(log:, line_ending: "\n", overrides: { organisation_id: "ORG#{log.owning_organisation_id}", managing_organisation_id: "ORG#{log.owning_organisation_id}" }) file.write(log_to_csv.default_field_numbers_row) file.write(log_to_csv.to_csv_row)