elsifincorrect_accuracy||value.to_d!=value.to_i# if the user enters a value in exponent notation (eg '4e1') the to_i method does not convert this to the correct value
@logger.error("Lettings log '#{attributes['old_id']}' belongs to legacy user with owner-user-id: '#{owner_id}' which cannot be found. Assigning log to 'Unassigned' user.")
@logger.error("Lettings log '#{attributes['old_id']}' belongs to legacy user with owner-user-id: '#{owner_id}' which cannot be found. Assigning log to 'Unassigned' user.")
else
@logger.error("Lettings log '#{attributes['old_id']}' belongs to legacy user with owner-user-id: '#{owner_id}' which belongs to a different organisation. Assigning log to 'Unassigned' user.")
@logger.error("Sales log '#{attributes['old_id']}' belongs to legacy user with owner-user-id: '#{owner_id}' which cannot be found. Assigning log to 'Unassigned' user.")
@logger.error("Sales log '#{attributes['old_id']}' belongs to legacy user with owner-user-id: '#{owner_id}' which cannot be found. Assigning log to 'Unassigned' user.")
else
@logger.error("Sales log '#{attributes['old_id']}' belongs to legacy user with owner-user-id: '#{owner_id}' which belongs to a different organisation. Assigning log to 'Unassigned' user.")
expect(storage_service).toreceive(:write_file).with("MissingAnswersReportSalesLog_report_suffix.csv","\uFEFFMissing answers,Total number of affected logs\n")
expect(storage_service).toreceive(:write_file).with("MissingAnswersExamplesSalesLog_report_suffix.csv","\uFEFFMissing answers,Organisation ID,Log ID,Old Form ID\n")
it"generates a csv with expected missing fields"do
expect(storage_service).toreceive(:write_file).with("MissingAnswersReportLettingsLog_report_suffix.csv","\uFEFFMissing answers,Total number of affected logs\n")
expect(storage_service).toreceive(:write_file).with("MissingAnswersExamplesLettingsLog_report_suffix.csv","\uFEFFMissing answers,Organisation ID,Log ID,Old Form ID\n")
expect(logger).toreceive(:error).with("Lettings log '0ead17cb-1668-442d-898c-0d52879ff592' belongs to legacy user with owner-user-id: 'fake_id' which belongs to a different organisation. Assigning log to 'Unassigned' user.")
expect(logger).toreceive(:error).with("Lettings log '0ead17cb-1668-442d-898c-0d52879ff592' belongs to legacy user with owner-user-id: 'fake_id' which belongs to a different organisation. Assigning log to 'Unassigned' user.")
expect(logger).toreceive(:error).with("Lettings log 'fake_id' belongs to legacy user with owner-user-id: 'fake_id' which belongs to a different organisation. Assigning log to 'Unassigned' user.")
it"creates a new unassigned user for current organisation"do
expect(logger).toreceive(:error).with("Lettings log '0ead17cb-1668-442d-898c-0d52879ff592' belongs to legacy user with owner-user-id: 'fake_id' which belongs to a different organisation. Assigning log to 'Unassigned' user.")
expect(logger).toreceive(:error).with("Sales log 'shared_ownership_sales_log' belongs to legacy user with owner-user-id: 'fake_id' which belongs to a different organisation. Assigning log to 'Unassigned' user.")
expect(logger).toreceive(:error).with("Sales log 'shared_ownership_sales_log' belongs to legacy user with owner-user-id: 'fake_id' which belongs to a different organisation. Assigning log to 'Unassigned' user.")
expect(logger).toreceive(:error).with("Sales log 'fake_id' belongs to legacy user with owner-user-id: 'fake_id' which belongs to a different organisation. Assigning log to 'Unassigned' user.")
it"creates a new unassigned user for current organisation"do
expect(logger).toreceive(:error).with("Sales log 'shared_ownership_sales_log' belongs to legacy user with owner-user-id: 'fake_id' which belongs to a different organisation. Assigning log to 'Unassigned' user.")