Merge branch 'master' into 9998-no-count-items-available
[arvados.git] / services / api / app / controllers / application_controller.rb
index cdfbdbbcc18b927bbbafe7241697781870fe8e97..3876e673fc80c96d19671248e4b14fbfa247351c 100644 (file)
@@ -506,10 +506,12 @@ class ApplicationController < ActionController::Base
       :limit => @limit,
       :items => @objects.as_api_response(nil, {select: @select})
     }
-    if @objects.respond_to? :except
-      list[:items_available] = @objects.
-        except(:limit).except(:offset).
-        count(:id, distinct: true)
+    if params[:count].nil? || params[:count]
+      if @objects.respond_to? :except
+        list[:items_available] = @objects.
+          except(:limit).except(:offset).
+          count(:id, distinct: true)
+      end
     end
     list
   end
@@ -572,6 +574,7 @@ class ApplicationController < ActionController::Base
       distinct: { type: 'boolean', required: false },
       limit: { type: 'integer', required: false, default: DEFAULT_LIMIT },
       offset: { type: 'integer', required: false, default: 0 },
+      count: { type: 'boolean', required: false, default: true},
     }
   end