Merge branch '15877-accept-json-in-json'
[arvados.git] / apps / workbench / app / controllers / container_requests_controller.rb
index 587819dd442c2c1fbe9a8261b491dfc41cc83742..8ce068198e313cbb172d0fd0b88bf43e50067438 100644 (file)
@@ -20,7 +20,7 @@ class ContainerRequestsController < ApplicationController
 
     # Search for child CRs
     if cr[:container_uuid]
-      child_crs = ContainerRequest.where(requesting_container_uuid: cr[:container_uuid])
+      child_crs = ContainerRequest.where(requesting_container_uuid: cr[:container_uuid]).with_count("none")
 
       child_crs.each do |child|
         nodes[child[:uuid]] = child
@@ -38,14 +38,14 @@ class ContainerRequestsController < ApplicationController
 
     # Batch requests to get all related collections
     # First fetch output collections by UUID.
-    Collection.filter([['uuid', 'in', col_uuids.uniq]]).each do |c|
+    Collection.filter([['uuid', 'in', col_uuids.uniq]]).with_count("none").each do |c|
       output_pdhs << c[:portable_data_hash]
       pdh_to_col[c[:portable_data_hash]] = c
       nodes[c[:uuid]] = c
     end
     # Next, get input collections by PDH.
     Collection.filter(
-      [['portable_data_hash', 'in', col_pdhs - output_pdhs]]).each do |c|
+      [['portable_data_hash', 'in', col_pdhs - output_pdhs]]).with_count("none").each do |c|
       nodes[c[:portable_data_hash]] = c
     end
 
@@ -73,7 +73,7 @@ class ContainerRequestsController < ApplicationController
 
   def cancel
     if @object.container_uuid
-      c = Container.select(['state']).where(uuid: @object.container_uuid).first
+      c = Container.select(['state']).where(uuid: @object.container_uuid).with_count("none").first
       if c && c.state != 'Running'
         # If the container hasn't started yet, setting priority=0
         # leaves our request in "Committed" state and doesn't cancel