[ARVADOS] updated: 037ecde427ca1049237e9b37801594f72887ce7f

Git user git at public.curoverse.com
Mon Sep 11 16:58:19 EDT 2017


Summary of changes:
 services/api/app/models/container.rb     | 4 +---
 services/api/test/unit/container_test.rb | 4 ++++
 2 files changed, 5 insertions(+), 3 deletions(-)

       via  037ecde427ca1049237e9b37801594f72887ce7f (commit)
      from  199ecdd6fede9b961bb90df05362bfc130863da5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 037ecde427ca1049237e9b37801594f72887ce7f
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Sep 11 16:57:06 2017 -0400

    12032: Container readable check uses subquery instead join to avoid returning
    duplicate rows.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>

diff --git a/services/api/app/models/container.rb b/services/api/app/models/container.rb
index d61ba75..0aeca6d 100644
--- a/services/api/app/models/container.rb
+++ b/services/api/app/models/container.rb
@@ -303,9 +303,7 @@ class Container < ArvadosModel
     else
       kwargs = {}
     end
-    kwargs[:query_on] = joins(:container_requests)
-    users_list.push kwargs
-    ContainerRequest.readable_by(*users_list)
+    Container.where(ContainerRequest.readable_by(*users_list).where("containers.uuid = container_requests.container_uuid").exists)
   end
 
   def final?
diff --git a/services/api/test/unit/container_test.rb b/services/api/test/unit/container_test.rb
index 0f3dab5..e8eff0a 100644
--- a/services/api/test/unit/container_test.rb
+++ b/services/api/test/unit/container_test.rb
@@ -443,6 +443,10 @@ class ContainerTest < ActiveSupport::TestCase
     check_no_change_from_cancelled c
   end
 
+  test "Container queued count" do
+    assert_equal 1, Container.readable_by(users(:active)).where(state: "Queued").count
+  end
+
   test "Container locked cancel" do
     c, _ = minimal_new
     set_user_from_auth :dispatch1

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list