The personal finance app for everyone (by everyone)
Ruby
Fix import flow regression.
Juan José Mata9642856b0d90
diff --git a/app/controllers/import/uploads_controller.rb b/app/controllers/import/uploads_controller.rbindex b7c1b1bbbd..3d8d447324 100644--- a/app/controllers/import/uploads_controller.rb+++ b/app/controllers/import/uploads_controller.rb@@ -23,26 +23,15 @@ class Import::UploadsController < ApplicationController@import.assign_attributes(raw_file_str: csv_str, col_sep: upload_params[:col_sep])@import.save!(validate: false)- redirect_to import_configuration_path(@import, template_hint: true), notice: "CSV uploaded successfully."+ redirect_to import_configuration_path(@import, template_hint: true), notice: t("imports.create.csv_uploaded")else- update_csv_import+ flash.now[:alert] = t("import.uploads.show.csv_invalid", default: "Must be valid CSV with headers and at least one row of data")++ render :show, status: :unprocessable_entityendendprivate- def update_csv_import- if csv_valid?(csv_str)- @import.account = Current.family.accounts.find_by(id: params.dig(:import, :account_id))- @import.assign_attributes(raw_file_str: csv_str, col_sep: upload_params[:col_sep])- @import.save!(validate: false)-- redirect_to import_configuration_path(@import, template_hint: true), notice: t("imports.create.csv_uploaded")- else- flash.now[:alert] = t("import.uploads.show.csv_invalid", default: "Must be valid CSV with headers and at least one row of data")-- render :show, status: :unprocessable_entity- end- enddef update_sure_import_uploaduploaded = upload_params[:ndjson_file]