mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
Merge pull request #6714 from luisramos0/rails5-new
[Rails 5] Update Gemfile_next.lock and fix app/services/permissions/order.rb
This commit is contained in:
11
Gemfile
11
Gemfile
@@ -15,13 +15,11 @@ if ENV['DEPENDENCIES_NEXT']
|
||||
gem 'rails', '> 5.0', '< 5.1'
|
||||
|
||||
gem 'activemerchant', '>= 1.78.0'
|
||||
gem 'angular-rails-templates', '>= 0.3.0'
|
||||
gem 'angular-rails-templates', '>= 0.3.0', '< 1.1.0'
|
||||
gem 'awesome_nested_set'
|
||||
gem 'rails-controller-testing'
|
||||
gem 'ransack', '2.3.0'
|
||||
gem 'responders'
|
||||
gem 'sass', '<= 4.7.1'
|
||||
gem 'sass-rails', '< 6.0.0'
|
||||
gem 'libv8', '< 8'
|
||||
else
|
||||
gem 'rails', '~> 4.2'
|
||||
|
||||
@@ -30,8 +28,6 @@ else
|
||||
gem 'awesome_nested_set', '~> 3.3.1'
|
||||
gem 'ransack', '~> 1.8.10'
|
||||
gem 'responders', '~> 2.0'
|
||||
gem 'sass'
|
||||
gem 'sass-rails'
|
||||
|
||||
gem 'db2fog'
|
||||
gem 'unicorn'
|
||||
@@ -120,12 +116,15 @@ gem 'test-unit', '~> 3.4'
|
||||
gem 'coffee-rails', '~> 4.2.2'
|
||||
gem 'compass-rails'
|
||||
|
||||
gem 'libv8', '< 8'
|
||||
gem 'mini_racer', '0.2.15'
|
||||
|
||||
gem 'uglifier', '>= 1.0.3'
|
||||
|
||||
gem 'angular_rails_csrf'
|
||||
gem 'foundation-icons-sass-rails'
|
||||
gem 'sass', '<= 4.7.1'
|
||||
gem 'sass-rails', '< 6.0.0'
|
||||
|
||||
gem 'foundation-rails', '= 5.5.2.1'
|
||||
|
||||
|
||||
@@ -785,6 +785,7 @@ DEPENDENCIES
|
||||
kaminari (~> 1.2.1)
|
||||
knapsack
|
||||
letter_opener (>= 1.4.1)
|
||||
libv8 (< 8)
|
||||
mini_racer (= 0.2.15)
|
||||
monetize (~> 1.10)
|
||||
oauth2 (~> 1.4.4)
|
||||
@@ -813,8 +814,8 @@ DEPENDENCIES
|
||||
rswag
|
||||
rubocop
|
||||
rubocop-rails
|
||||
sass
|
||||
sass-rails
|
||||
sass (<= 4.7.1)
|
||||
sass-rails (< 6.0.0)
|
||||
select2-rails (~> 3.4.7)
|
||||
selenium-webdriver
|
||||
shoulda-matchers
|
||||
|
||||
@@ -100,8 +100,8 @@ GEM
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
andand (1.3.3)
|
||||
angular-rails-templates (1.1.0)
|
||||
railties (>= 4.2, < 7)
|
||||
angular-rails-templates (1.0.2)
|
||||
railties (>= 4.2, < 6)
|
||||
sprockets (>= 3.0, < 5)
|
||||
tilt
|
||||
angular_rails_csrf (4.2.0)
|
||||
@@ -163,7 +163,7 @@ GEM
|
||||
sass (>= 3.2, < 3.5)
|
||||
compass-rails (2.0.1)
|
||||
compass (~> 1.0.0)
|
||||
concurrent-ruby (1.1.7)
|
||||
concurrent-ruby (1.1.8)
|
||||
crack (0.4.4)
|
||||
crass (1.0.6)
|
||||
css_parser (1.7.1)
|
||||
@@ -230,7 +230,7 @@ GEM
|
||||
tilt
|
||||
hashdiff (1.0.1)
|
||||
highline (2.0.3)
|
||||
i18n (1.8.5)
|
||||
i18n (1.8.7)
|
||||
concurrent-ruby (~> 1.0)
|
||||
i18n-js (3.8.0)
|
||||
i18n (>= 0.6.6)
|
||||
@@ -271,7 +271,7 @@ GEM
|
||||
letter_opener (1.7.0)
|
||||
launchy (~> 2.2)
|
||||
libv8 (7.3.492.27.1)
|
||||
loofah (2.7.0)
|
||||
loofah (2.9.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.1)
|
||||
@@ -284,10 +284,10 @@ GEM
|
||||
mini_portile2 (2.4.0)
|
||||
mini_racer (0.2.15)
|
||||
libv8 (> 7.3)
|
||||
minitest (5.14.2)
|
||||
monetize (1.9.4)
|
||||
minitest (5.14.3)
|
||||
monetize (1.10.0)
|
||||
money (~> 6.12)
|
||||
money (6.13.8)
|
||||
money (6.14.0)
|
||||
i18n (>= 0.6.4, <= 2)
|
||||
msgpack (1.3.3)
|
||||
multi_json (1.15.0)
|
||||
@@ -319,11 +319,11 @@ GEM
|
||||
activerecord (>= 4.0, < 6.1)
|
||||
parser (2.7.2.0)
|
||||
ast (~> 2.4.1)
|
||||
paypal-sdk-core (0.2.10)
|
||||
paypal-sdk-core (0.3.4)
|
||||
multi_json (~> 1.0)
|
||||
xml-simple
|
||||
paypal-sdk-merchant (1.106.1)
|
||||
paypal-sdk-core (~> 0.2.3)
|
||||
paypal-sdk-merchant (1.117.2)
|
||||
paypal-sdk-core (~> 0.3.0)
|
||||
pg (0.21.0)
|
||||
polyamorous (2.3.0)
|
||||
activerecord (>= 5.0)
|
||||
@@ -357,6 +357,10 @@ GEM
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.0.7.2)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.5)
|
||||
actionpack (>= 5.0.1.rc1)
|
||||
actionview (>= 5.0.1.rc1)
|
||||
activesupport (>= 5.0.1.rc1)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
@@ -374,7 +378,7 @@ GEM
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
rainbow (3.0.0)
|
||||
raindrops (0.19.1)
|
||||
rake (13.0.1)
|
||||
rake (13.0.3)
|
||||
ransack (2.3.0)
|
||||
actionpack (>= 5.0)
|
||||
activerecord (>= 5.0)
|
||||
@@ -506,7 +510,7 @@ GEM
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.10)
|
||||
timecop (0.9.2)
|
||||
tzinfo (1.2.8)
|
||||
tzinfo (1.2.9)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (4.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
@@ -538,7 +542,7 @@ GEM
|
||||
wicked_pdf (2.1.0)
|
||||
activesupport
|
||||
wkhtmltopdf-binary (0.12.6.5)
|
||||
xml-simple (1.1.5)
|
||||
xml-simple (1.1.8)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
|
||||
@@ -555,7 +559,7 @@ DEPENDENCIES
|
||||
acts-as-taggable-on (~> 4.0)
|
||||
acts_as_list (= 0.9.19)
|
||||
andand
|
||||
angular-rails-templates (>= 0.3.0)
|
||||
angular-rails-templates (>= 0.3.0, < 1.1.0)
|
||||
angular_rails_csrf
|
||||
angularjs-file-upload-rails (~> 2.4.1)
|
||||
angularjs-rails (= 1.5.5)
|
||||
@@ -608,14 +612,14 @@ DEPENDENCIES
|
||||
letter_opener (>= 1.4.1)
|
||||
libv8 (< 8)
|
||||
mini_racer (= 0.2.15)
|
||||
monetize (~> 1.1)
|
||||
monetize (~> 1.10)
|
||||
oauth2 (~> 1.4.4)
|
||||
ofn-qz!
|
||||
order_management!
|
||||
paper_trail (~> 10.3.1)
|
||||
paperclip (~> 3.4.1)
|
||||
paranoia (~> 2.4)
|
||||
paypal-sdk-merchant (= 1.106.1)
|
||||
paypal-sdk-merchant (= 1.117.2)
|
||||
pg (~> 0.21.0)
|
||||
pry
|
||||
pry-byebug
|
||||
@@ -623,6 +627,7 @@ DEPENDENCIES
|
||||
rack-rewrite
|
||||
rack-ssl
|
||||
rails (> 5.0, < 5.1)
|
||||
rails-controller-testing
|
||||
rails-i18n
|
||||
rails_safe_tasks (~> 1.0)
|
||||
ransack (= 2.3.0)
|
||||
|
||||
@@ -63,28 +63,36 @@ module Permissions
|
||||
|
||||
# Any orders placed through any hub that I manage
|
||||
def managed_orders_where_values
|
||||
Spree::Order.
|
||||
where(distributor_id: @permissions.managed_enterprises.select("enterprises.id")).
|
||||
where_values.
|
||||
reduce(:and)
|
||||
query = Spree::Order.
|
||||
where(distributor_id: @permissions.managed_enterprises.select("enterprises.id"))
|
||||
|
||||
apply_where_clause(query).reduce(:and)
|
||||
end
|
||||
|
||||
# Any order that is placed through an order cycle one of my managed enterprises coordinates
|
||||
def coordinated_orders_where_values
|
||||
Spree::Order.
|
||||
where(order_cycle_id: @permissions.coordinated_order_cycles.select(:id)).
|
||||
where_values.
|
||||
reduce(:and)
|
||||
query = Spree::Order.
|
||||
where(order_cycle_id: @permissions.coordinated_order_cycles.select(:id))
|
||||
|
||||
apply_where_clause(query).reduce(:and)
|
||||
end
|
||||
|
||||
def produced_orders_where_values
|
||||
Spree::Order.with_line_items_variants_and_products_outer.
|
||||
query = Spree::Order.with_line_items_variants_and_products_outer.
|
||||
where(
|
||||
distributor_id: granted_distributor_ids,
|
||||
spree_products: { supplier_id: enterprises_with_associated_orders }
|
||||
).
|
||||
where_values.
|
||||
reduce(:and)
|
||||
)
|
||||
|
||||
apply_where_clause(query).reduce(:and)
|
||||
end
|
||||
|
||||
def apply_where_clause(query)
|
||||
if ENV['DEPENDENCIES_NEXT']
|
||||
query.where_clause.__send__(:predicates)
|
||||
else
|
||||
query.where_values
|
||||
end
|
||||
end
|
||||
|
||||
def enterprises_with_associated_orders
|
||||
|
||||
Reference in New Issue
Block a user