From 93efd969e51f28e6ae81e1b95fd322dbed3abd41 Mon Sep 17 00:00:00 2001 From: Daniel Baark <5101747+baarkerlounger@users.noreply.github.com> Date: Wed, 17 Nov 2021 08:56:47 +0000 Subject: [PATCH] Form changes and small fixes (#96) * Remove tenancy code question * Rubocop * Fix spec * Use Gov component gem header --- app/models/bulk_upload.rb | 10 ++++---- app/views/layouts/application.html.erb | 25 +++++--------------- config/forms/2021_2022.json | 12 ---------- db/migrate/20211116102527_change_datetime.rb | 11 ++++++++- db/schema.rb | 4 ++-- 5 files changed, 24 insertions(+), 38 deletions(-) diff --git a/app/models/bulk_upload.rb b/app/models/bulk_upload.rb index f546ea56d..dcab1753f 100644 --- a/app/models/bulk_upload.rb +++ b/app/models/bulk_upload.rb @@ -26,12 +26,14 @@ class BulkUpload else data_range = FIRST_DATA_ROW..last_row data_range.map do |row_num| - case_log = CaseLog.create + case_log = CaseLog.create! map_row(sheet.row(row_num)).each do |attr_key, attr_val| - begin - case_log.update_attribute(attr_key, attr_val) - rescue ArgumentError + update = case_log.update(attr_key => attr_val) + unless update + # TODO: determine what to do when a bulk upload contains field values that don't pass validations end + rescue ArgumentError + # TODO: determine what we want to do when bulk upload contains totally invalid data for a field. end end end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 7ea45b6e4..ad52856b9 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -33,25 +33,12 @@ Skip to main content