From 5828355672e3fc7926125dcc35882a642a4cde1a Mon Sep 17 00:00:00 2001 From: radhika Date: Thu, 4 Sep 2014 16:55:36 -0400 Subject: [PATCH] 3710: handle the scenario where files from named collections are selected --- .../app/controllers/actions_controller.rb | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/workbench/app/controllers/actions_controller.rb b/apps/workbench/app/controllers/actions_controller.rb index ec71accbed..a5c2e94adc 100644 --- a/apps/workbench/app/controllers/actions_controller.rb +++ b/apps/workbench/app/controllers/actions_controller.rb @@ -139,29 +139,36 @@ class ActionsController < ApplicationController end end - collections = Collection.where(uuid: lst) - + lst = lst.uniq chash = {} + + collections = Collection.where(uuid: lst) collections.each do |c| c.reload() chash[c.uuid] = c end + collections = Collection.where(portable_data_hash: lst) + collections.each do |c| + c.reload() + chash[c.portable_data_hash] = c + end + combined = "" files.each do |m| if CollectionsHelper.match_uuid_with_optional_filepath(m[0]) - mt = chash[m[1]].manifest_text + mt = chash[m[1]].andand.manifest_text if m[2].andand.size>0 combined += arv_normalize mt, '--extract', m[2][1..-1] else - combined += chash[m[1]].manifest_text + combined += mt end else - mt = chash[m[1]+m[2]].manifest_text - if m[4] + mt = chash[m[1]+m[2]].andand.manifest_text + if m[4].andand.size>0 combined += arv_normalize mt, '--extract', m[4][1..-1] else - combined += chash[m[1]+m[2]].manifest_text + combined += mt end end end -- 2.39.5