Rename params method

This commit is contained in:
Urban Rotnik 2020-06-11 16:11:23 +02:00
parent c7d6c4d60e
commit 39eb8145c2
2 changed files with 8 additions and 7 deletions

View file

@ -129,7 +129,7 @@ class RepositoryRowsController < ApplicationController
def copy_records
duplicate_service = RepositoryActions::DuplicateRows.new(
current_user, @repository, copy_records_params
current_user, @repository, selected_rows_in_repo_params
)
duplicate_service.call
render json: {
@ -173,7 +173,7 @@ class RepositoryRowsController < ApplicationController
def archive_records
service = RepositoryActions::ArchiveRowsService.call(repository: @repository,
repository_rows: copy_records_params,
repository_rows: selected_rows_in_repo_params,
user: current_user,
team: current_team)
@ -186,7 +186,7 @@ class RepositoryRowsController < ApplicationController
def restore_records
service = RepositoryActions::RestoreRowsService.call(repository: @repository,
repository_rows: copy_records_params,
repository_rows: selected_rows_in_repo_params,
user: current_user,
team: current_team)
@ -250,7 +250,8 @@ class RepositoryRowsController < ApplicationController
params.permit(selected_rows: []).to_h[:selected_rows]
end
def copy_records_params
# Selected rows in scope of current @repository
def selected_rows_in_repo_params
process_ids = params[:selected_rows].map(&:to_i).uniq
@repository.repository_rows.where(id: process_ids).pluck(:id)
end

View file

@ -283,8 +283,8 @@ class Extends
set_task_start_date: 138,
change_task_start_date: 139,
remove_task_start_date: 140,
archive_inventory_item: 141,
restore_inventory_item: 142
archive_inventory_item: 142,
restore_inventory_item: 143
}
ACTIVITY_GROUPS = {
@ -295,7 +295,7 @@ class Extends
task_inventory: [55, 56],
experiment: [*27..31, 57],
reports: [48, 50, 49],
inventories: [70, 71, 105, 72, 73, 74, 102, 75, 76, 77, 78, 96, 107, 113, 114, *133..136, 141, 142],
inventories: [70, 71, 105, 72, 73, 74, 102, 75, 76, 77, 78, 96, 107, 113, 114, *133..136, 142, 143],
protocol_repository: [80, 103, 89, 87, 79, 90, 91, 88, 85, 86, 84, 81, 82,
83, 101, 112, 123, 125, 117, 119, 129, 131],
team: [92, 94, 93, 97, 104]