From dd13a3b87cbbd38ab9800d321d00d8da86159a1f Mon Sep 17 00:00:00 2001 From: "Stanko K.R." Date: Fri, 30 Jan 2026 16:33:21 +0100 Subject: [PATCH] Style --- app/models/account/import.rb | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/app/models/account/import.rb b/app/models/account/import.rb index bc879e3ee..c5e6896cf 100644 --- a/app/models/account/import.rb +++ b/app/models/account/import.rb @@ -12,6 +12,16 @@ class Account::Import < ApplicationRecord ImportAccountDataJob.perform_later(self) end + def check(start: nil, callback: nil) + processing! + + ZipFile.read_from(file.blob) do |zip| + Account::DataTransfer::Manifest.new(account).each_record_set(start: start) do |record_set, last_id| + record_set.check(from: zip, start: last_id, callback: callback) + end + end + end + def process(start: nil, callback: nil) processing! @@ -23,24 +33,18 @@ class Account::Import < ApplicationRecord mark_completed rescue => e - failed! - ImportMailer.failed(identity).deliver_later + mark_as_failed raise e end - def check(start: nil, callback: nil) - processing! - - ZipFile.read_from(file.blob) do |zip| - Account::DataTransfer::Manifest.new(account).each_record_set(start: start) do |record_set, last_id| - record_set.check(from: zip, start: last_id, callback: callback) - end - end - end - private def mark_completed completed! ImportMailer.completed(identity, account).deliver_later end + + def mark_as_failed + failed! + ImportMailer.failed(identity).deliver_later + end end