[ARVADOS] created: c68037a915e0a0680c041e0c926e49233c2823f7

git at public.curoverse.com git at public.curoverse.com
Tue Mar 10 14:46:02 EDT 2015


        at  c68037a915e0a0680c041e0c926e49233c2823f7 (commit)


commit c68037a915e0a0680c041e0c926e49233c2823f7
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Tue Mar 10 14:44:50 2015 -0400

    5304: include nulls in resutls when filter operator is "!="

diff --git a/services/api/lib/record_filters.rb b/services/api/lib/record_filters.rb
index c009bf5..350c380 100644
--- a/services/api/lib/record_filters.rb
+++ b/services/api/lib/record_filters.rb
@@ -77,7 +77,12 @@ module RecordFilters
                                     "boolean attribute '#{attr}'")
               end
             end
-            cond_out << "#{ar_table_name}.#{attr} #{operator} ?"
+            if operator == '<>'
+              # explicitly allow NULL
+              cond_out << "#{ar_table_name}.#{attr} #{operator} ? OR #{ar_table_name}.#{attr} IS NULL"
+            else
+              cond_out << "#{ar_table_name}.#{attr} #{operator} ?"
+            end
             if (# any operator that operates on value rather than
                 # representation:
                 operator.match(/[<=>]/) and (attr_type == :datetime))
diff --git a/services/api/test/fixtures/groups.yml b/services/api/test/fixtures/groups.yml
index fb23c8c..7b4f8be 100644
--- a/services/api/test/fixtures/groups.yml
+++ b/services/api/test/fixtures/groups.yml
@@ -224,6 +224,17 @@ fuse_owned_project:
   description: Test project belonging to FUSE test user
   group_class: project
 
+group_with_no_class:
+  uuid: zzzzz-j7d0g-groupwithnoclas
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  created_at: 2014-04-21 15:37:48 -0400
+  modified_by_client_uuid: zzzzz-ozdt8-brczlopd8u8d0jr
+  modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  modified_at: 2014-04-21 15:37:48 -0400
+  updated_at: 2014-04-21 15:37:48 -0400
+  name: group_with_no_class
+  description: This group has no class at all. So rude!
+
 # This wouldn't pass model validation, but it enables a workbench
 # infinite-loop test. See #4389
 project_owns_itself:
diff --git a/services/api/test/functional/arvados/v1/groups_controller_test.rb b/services/api/test/functional/arvados/v1/groups_controller_test.rb
index 922612f..1d7bb77 100644
--- a/services/api/test/functional/arvados/v1/groups_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/groups_controller_test.rb
@@ -41,6 +41,7 @@ class Arvados::V1::GroupsControllerTest < ActionController::TestCase
     assert_not_includes group_uuids, groups(:aproject).uuid
     assert_not_includes group_uuids, groups(:asubproject).uuid
     assert_includes group_uuids, groups(:private).uuid
+    assert_includes group_uuids, groups(:group_with_no_class).uuid
   end
 
   test "get list of groups with bogus group_class" do

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list