[ARVADOS] updated: 100e1ab71d64e21f1c21de2fc305a6f92fa244dc

git at public.curoverse.com git at public.curoverse.com
Mon May 12 13:46:06 EDT 2014


Summary of changes:
 apps/workbench/app/models/arvados_api_client.rb         |  2 +-
 apps/workbench/app/models/job.rb                        |  4 ++++
 services/api/lib/record_filters.rb                      |  4 ++++
 services/api/test/functional/arvados/v1/filters_test.rb | 16 ++++++++++++++++
 4 files changed, 25 insertions(+), 1 deletion(-)
 create mode 100644 services/api/test/functional/arvados/v1/filters_test.rb

       via  100e1ab71d64e21f1c21de2fc305a6f92fa244dc (commit)
       via  8aaf3a61c6981160eaa779fb32064895de00e5a6 (commit)
      from  d455c8373cf39f4310d2b0e13e7a9d02aca0b2ab (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 100e1ab71d64e21f1c21de2fc305a6f92fa244dc
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon May 12 13:43:09 2014 -0400

    2754: Hide unhelpful "Add a new job" button.

diff --git a/apps/workbench/app/models/job.rb b/apps/workbench/app/models/job.rb
index f88834e..eb81f40 100644
--- a/apps/workbench/app/models/job.rb
+++ b/apps/workbench/app/models/job.rb
@@ -2,4 +2,8 @@ class Job < ArvadosBase
   def attribute_editable?(attr)
     false
   end
+
+  def self.creatable?
+    false
+  end
 end

commit 8aaf3a61c6981160eaa779fb32064895de00e5a6
Author: Tom Clegg <tom at curoverse.com>
Date:   Mon May 12 13:36:43 2014 -0400

    2812: Fix "not in" filter so it can retrieve rows with null values.
    
    closes #2812

diff --git a/apps/workbench/app/models/arvados_api_client.rb b/apps/workbench/app/models/arvados_api_client.rb
index c7f7d34..c6d8720 100644
--- a/apps/workbench/app/models/arvados_api_client.rb
+++ b/apps/workbench/app/models/arvados_api_client.rb
@@ -57,7 +57,7 @@ class ArvadosApiClient
 
     header = {"Accept" => "application/json"}
 
-    profile_checkpoint { "Prepare request #{url} #{query[:uuid]} #{query[:where]}" }
+    profile_checkpoint { "Prepare request #{url} #{query[:uuid]} #{query[:where]} #{query[:filters]}" }
     msg = @@api_client.post(url,
                             query,
                             header: header)
diff --git a/services/api/lib/record_filters.rb b/services/api/lib/record_filters.rb
index d3727d3..01d0ae4 100644
--- a/services/api/lib/record_filters.rb
+++ b/services/api/lib/record_filters.rb
@@ -54,6 +54,10 @@ module RecordFilters
         if operand.is_a? Array
           cond_out << "#{ar_table_name}.#{attr} #{operator} (?)"
           param_out << operand
+          if operator == 'not in' and not operand.include?(nil)
+            # explicitly allow NULL
+            cond_out[-1] = "(#{cond_out[-1]} OR #{ar_table_name}.#{attr} IS NULL)"
+          end
         else
           raise ArgumentError.new("Invalid operand type '#{operand.class}' "\
                                   "for '#{operator}' operator in filters")
diff --git a/services/api/test/functional/arvados/v1/filters_test.rb b/services/api/test/functional/arvados/v1/filters_test.rb
new file mode 100644
index 0000000..a5582e6
--- /dev/null
+++ b/services/api/test/functional/arvados/v1/filters_test.rb
@@ -0,0 +1,16 @@
+require 'test_helper'
+
+class Arvados::V1::FiltersTest < ActionController::TestCase
+  test '"not in" filter passes null values' do
+    @controller = Arvados::V1::GroupsController.new
+    authorize_with :admin
+    get :index, {
+      filters: [ ['group_class', 'not in', ['folder']] ],
+      controller: 'groups',
+    }
+    assert_response :success
+    found = assigns(:objects)
+    assert_includes(found.collect(&:group_class), nil,
+                    "'group_class not in ['folder']' filter should pass null")
+  end
+end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list