From ddc7cf9bf60cab91ecde054330e4cccfd3f10e64 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Fri, 13 Sep 2024 15:34:46 +0200 Subject: [PATCH] Remove obsolete logic from location importer [SCI-11050] --- app/controllers/storage_locations_controller.rb | 2 +- app/services/storage_locations/import_service.rb | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/controllers/storage_locations_controller.rb b/app/controllers/storage_locations_controller.rb index 92d8a33de..2c14340bb 100644 --- a/app/controllers/storage_locations_controller.rb +++ b/app/controllers/storage_locations_controller.rb @@ -133,7 +133,7 @@ class StorageLocationsController < ApplicationController def import_container result = StorageLocations::ImportService.new(@storage_location, params[:file], current_user).import_items if result[:status] == :ok - if (result[:assigned_count] + result[:unassigned_count] + result[:updated_count]).positive? + if (result[:assigned_count] + result[:unassigned_count]).positive? log_activity( :storage_location_imported, { diff --git a/app/services/storage_locations/import_service.rb b/app/services/storage_locations/import_service.rb index 78216c45b..01a6a29fe 100644 --- a/app/services/storage_locations/import_service.rb +++ b/app/services/storage_locations/import_service.rb @@ -8,7 +8,6 @@ module StorageLocations @storage_location = storage_location @assigned_count = 0 @unassigned_count = 0 - @updated_count = 0 @sheet = SpreadsheetParser.open_spreadsheet(file) @user = user end @@ -73,12 +72,10 @@ module StorageLocations metadata: { position: row[:position] } ) - @assigned_count += 1 if storage_location_repository_row.new_record? - - storage_location_repository_row.update!( - repository_row_id: row[:repository_row_id], - created_by: storage_location_repository_row.created_by || @user - ) + if storage_location_repository_row.new_record? + @assigned_count += 1 + storage_location_repository_row.update!(created_by: @user) + end end def unassign_repository_rows!