mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-07 07:36:58 +00:00
Compare commits
130 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e4ad6d736b | ||
|
|
9f30471373 | ||
|
|
fa373518fb | ||
|
|
89cb3b7c14 | ||
|
|
3e0b358370 | ||
|
|
f206b7ed9e | ||
|
|
a409d3b97e | ||
|
|
1f661c1e69 | ||
|
|
97f51d24b8 | ||
|
|
c3d274c84f | ||
|
|
0b03152f3b | ||
|
|
6f492d868c | ||
|
|
dab2a4af75 | ||
|
|
f7935bde34 | ||
|
|
61850f7e92 | ||
|
|
7df456c1e3 | ||
|
|
2fa86492d1 | ||
|
|
85860692ae | ||
|
|
8ad4d2cc2e | ||
|
|
c967eca9c4 | ||
|
|
7fff82eec3 | ||
|
|
c30ed0f7c8 | ||
|
|
cde420716b | ||
|
|
ee37c5d4a3 | ||
|
|
e9d236f761 | ||
|
|
8b78c28feb | ||
|
|
871b2f8816 | ||
|
|
214bdc6fbe | ||
|
|
d2fce053a7 | ||
|
|
11a7aa9f96 | ||
|
|
c0203e7091 | ||
|
|
44cc5cc665 | ||
|
|
6c8e383ab8 | ||
|
|
5c6d9a092e | ||
|
|
8d500a2c27 | ||
|
|
425674c4e5 | ||
|
|
e91e827f29 | ||
|
|
8f201c830a | ||
|
|
1b536d9265 | ||
|
|
1b8a9244a6 | ||
|
|
a40e883d17 | ||
|
|
6bf21d2abd | ||
|
|
29b9777a96 | ||
|
|
283dd84ad6 | ||
|
|
03828c5608 | ||
|
|
dad4061ff9 | ||
|
|
b19df0dfbf | ||
|
|
efb2ae6843 | ||
|
|
407fca17cb | ||
|
|
33409725a5 | ||
|
|
c70a694111 | ||
|
|
9c88c77066 | ||
|
|
42585bb074 | ||
|
|
b0211d0930 | ||
|
|
0675422509 | ||
|
|
5ff1b0d358 | ||
|
|
43cbac7d17 | ||
|
|
98e4f867b4 | ||
|
|
ebb15781d5 | ||
|
|
028c4f4281 | ||
|
|
ef7dfa3b4f | ||
|
|
71f9415d21 | ||
|
|
12848acf21 | ||
|
|
4f751c2711 | ||
|
|
920e2564a4 | ||
|
|
6b4e150e2a | ||
|
|
2d43e32688 | ||
|
|
a6cd393c57 | ||
|
|
b1060bf1c9 | ||
|
|
1bf5fbaf3a | ||
|
|
2ace3afd67 | ||
|
|
0bfceb877d | ||
|
|
c1d28b2e8f | ||
|
|
2841b42296 | ||
|
|
98e44e7a40 | ||
|
|
51c6c19f80 | ||
|
|
26947a64c0 | ||
|
|
df5c21048a | ||
|
|
8a124fb6be | ||
|
|
ced49e0217 | ||
|
|
75b7a1864b | ||
|
|
281d0eb417 | ||
|
|
496f5199c9 | ||
|
|
f13c0e1dca | ||
|
|
f801d4a4cb | ||
|
|
d94da8df1e | ||
|
|
70d9cfa08e | ||
|
|
193ae7936e | ||
|
|
0971e8d9b5 | ||
|
|
e78b44b9ca | ||
|
|
c5779eff81 | ||
|
|
b616c14f63 | ||
|
|
03cb14c926 | ||
|
|
da78e06a39 | ||
|
|
f4c351febf | ||
|
|
30184ac6aa | ||
|
|
a123d45eca | ||
|
|
a75f16e23c | ||
|
|
546e90b286 | ||
|
|
bf9f47a000 | ||
|
|
3da6e6b5ed | ||
|
|
111705f6f2 | ||
|
|
68d5327b12 | ||
|
|
688285c374 | ||
|
|
15058299d8 | ||
|
|
4e92f33b1c | ||
|
|
c7cb982c9a | ||
|
|
34e9112c0a | ||
|
|
28eb11bda5 | ||
|
|
d8e82d9c88 | ||
|
|
061fc321b4 | ||
|
|
5201e54f82 | ||
|
|
5192a08082 | ||
|
|
94d3f136e2 | ||
|
|
db3a923ea7 | ||
|
|
619eb43c57 | ||
|
|
5c221621d3 | ||
|
|
60d7ed5036 | ||
|
|
e74328f1d7 | ||
|
|
6abd652251 | ||
|
|
3821eede51 | ||
|
|
020af0c0e4 | ||
|
|
00a3976905 | ||
|
|
3bd8e430f9 | ||
|
|
77733169fc | ||
|
|
54d5d0ed80 | ||
|
|
ac5cbcf19e | ||
|
|
e10ea4b686 | ||
|
|
913f8bbad0 | ||
|
|
fc951e92ac |
@@ -11,3 +11,9 @@ OFN_REDIS_URL="redis://localhost:6379/1"
|
|||||||
OFN_REDIS_JOBS_URL="redis://localhost:6379/2"
|
OFN_REDIS_JOBS_URL="redis://localhost:6379/2"
|
||||||
|
|
||||||
SITE_URL="0.0.0.0:3000"
|
SITE_URL="0.0.0.0:3000"
|
||||||
|
|
||||||
|
# Deactivate rack-timeout in development.
|
||||||
|
# https://github.com/zombocom/rack-timeout#configuring
|
||||||
|
RACK_TIMEOUT_SERVICE_TIMEOUT="0"
|
||||||
|
RACK_TIMEOUT_WAIT_TIMEOUT="0"
|
||||||
|
RACK_TIMEOUT_WAIT_OVERTIME="0"
|
||||||
|
|||||||
1
.github/workflows/brakeman-analysis.yml
vendored
1
.github/workflows/brakeman-analysis.yml
vendored
@@ -41,6 +41,7 @@ jobs:
|
|||||||
- name: Scan
|
- name: Scan
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
|
git show --no-patch # the commit being tested (which is often a merge due to actions/checkout@v3)
|
||||||
brakeman -f sarif -o output.sarif.json .
|
brakeman -f sarif -o output.sarif.json .
|
||||||
|
|
||||||
# Upload the SARIF file generated in the previous step
|
# Upload the SARIF file generated in the previous step
|
||||||
|
|||||||
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -68,7 +68,6 @@ jobs:
|
|||||||
bundle exec rake db:schema:load
|
bundle exec rake db:schema:load
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
|
|
||||||
env:
|
env:
|
||||||
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 864ef557d85ea8e603e086c0387d5154
|
KNAPSACK_PRO_TEST_SUITE_TOKEN_RSPEC: 864ef557d85ea8e603e086c0387d5154
|
||||||
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
|
KNAPSACK_PRO_CI_NODE_TOTAL: ${{ matrix.ci_node_total }}
|
||||||
@@ -82,8 +81,8 @@ jobs:
|
|||||||
# https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it
|
# https://knapsackpro.com/faq/question/how-to-split-slow-rspec-test-files-by-test-examples-by-individual-it
|
||||||
#KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true
|
#KNAPSACK_PRO_RSPEC_SPLIT_BY_TEST_EXAMPLES: true
|
||||||
KNAPSACK_PRO_TEST_FILE_PATTERN: "{spec/controllers/**/*_spec.rb}"
|
KNAPSACK_PRO_TEST_FILE_PATTERN: "{spec/controllers/**/*_spec.rb}"
|
||||||
|
|
||||||
run: |
|
run: |
|
||||||
|
git show --no-patch # the commit being tested (which is often a merge due to actions/checkout@v3)
|
||||||
bundle exec rake knapsack_pro:rspec
|
bundle exec rake knapsack_pro:rspec
|
||||||
|
|
||||||
knapsack_rspec_models:
|
knapsack_rspec_models:
|
||||||
|
|||||||
6
.github/workflows/linters.yml
vendored
6
.github/workflows/linters.yml
vendored
@@ -9,7 +9,11 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
- uses: ruby/setup-ruby@v1
|
- uses: ruby/setup-ruby@v1
|
||||||
|
|
||||||
|
- run: git show --no-patch # the commit being tested (which is often a merge due to actions/checkout@v3)
|
||||||
|
|
||||||
- name: rubocop
|
- name: rubocop
|
||||||
uses: reviewdog/action-rubocop@v2
|
uses: reviewdog/action-rubocop@v2
|
||||||
with:
|
with:
|
||||||
@@ -32,6 +36,8 @@ jobs:
|
|||||||
- name: Install JS dependencies
|
- name: Install JS dependencies
|
||||||
run: yarn install --frozen-lockfile
|
run: yarn install --frozen-lockfile
|
||||||
|
|
||||||
|
- run: git show --no-patch # the commit being tested (which is often a merge due to actions/checkout@v3)
|
||||||
|
|
||||||
- name: prettier
|
- name: prettier
|
||||||
uses: EPMatt/reviewdog-action-prettier@v1
|
uses: EPMatt/reviewdog-action-prettier@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
#
|
#
|
||||||
# These are the rules we agreed upon and we work towards.
|
# These are the rules we agreed upon and we work towards.
|
||||||
AllCops:
|
AllCops:
|
||||||
NewCops: disable
|
NewCops: enable
|
||||||
SuggestExtensions: false
|
SuggestExtensions: false
|
||||||
TargetRailsVersion: 5.0
|
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'bin/**/*'
|
- 'bin/**/*'
|
||||||
- 'db/**/*'
|
- 'db/**/*'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400`
|
# `rubocop --auto-gen-config --auto-gen-only-exclude --exclude-limit 1400`
|
||||||
# on 2023-04-01 00:21:28 UTC using RuboCop version 1.47.0.
|
# on 2023-04-14 06:27:24 UTC using RuboCop version 1.50.1.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
@@ -14,6 +14,28 @@ Bundler/OrderedGems:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'Gemfile'
|
- 'Gemfile'
|
||||||
|
|
||||||
|
# Offense count: 4
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
# Configuration parameters: Severity, Include.
|
||||||
|
# Include: **/*.gemspec
|
||||||
|
Gemspec/DeprecatedAttributeAssignment:
|
||||||
|
Exclude:
|
||||||
|
- 'engines/catalog/catalog.gemspec'
|
||||||
|
- 'engines/dfc_provider/dfc_provider.gemspec'
|
||||||
|
- 'engines/order_management/order_management.gemspec'
|
||||||
|
- 'engines/web/web.gemspec'
|
||||||
|
|
||||||
|
# Offense count: 4
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
# Configuration parameters: Severity, Include.
|
||||||
|
# Include: **/*.gemspec
|
||||||
|
Gemspec/RequireMFA:
|
||||||
|
Exclude:
|
||||||
|
- 'engines/catalog/catalog.gemspec'
|
||||||
|
- 'engines/dfc_provider/dfc_provider.gemspec'
|
||||||
|
- 'engines/order_management/order_management.gemspec'
|
||||||
|
- 'engines/web/web.gemspec'
|
||||||
|
|
||||||
# Offense count: 4
|
# Offense count: 4
|
||||||
# Configuration parameters: Severity, Include.
|
# Configuration parameters: Severity, Include.
|
||||||
# Include: **/*.gemspec
|
# Include: **/*.gemspec
|
||||||
@@ -63,11 +85,10 @@ Layout/BlockAlignment:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/services/products_renderer_spec.rb'
|
- 'spec/services/products_renderer_spec.rb'
|
||||||
|
|
||||||
# Offense count: 5
|
# Offense count: 4
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
Layout/BlockEndNewline:
|
Layout/BlockEndNewline:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/admin/subscriptions_controller.rb'
|
|
||||||
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
|
- 'spec/lib/open_food_network/enterprise_fee_calculator_spec.rb'
|
||||||
- 'spec/system/admin/orders_spec.rb'
|
- 'spec/system/admin/orders_spec.rb'
|
||||||
|
|
||||||
@@ -100,14 +121,13 @@ Layout/ExtraSpacing:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/spec_helper.rb'
|
- 'spec/spec_helper.rb'
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 2
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||||
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
|
||||||
Layout/FirstArgumentIndentation:
|
Layout/FirstArgumentIndentation:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/system/admin/orders_spec.rb'
|
- 'spec/system/admin/orders_spec.rb'
|
||||||
- 'spec/system/admin/products_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
@@ -117,7 +137,7 @@ Layout/FirstHashElementIndentation:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/services/products_renderer_spec.rb'
|
- 'spec/services/products_renderer_spec.rb'
|
||||||
|
|
||||||
# Offense count: 13
|
# Offense count: 11
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
||||||
# SupportedHashRocketStyles: key, separator, table
|
# SupportedHashRocketStyles: key, separator, table
|
||||||
@@ -125,31 +145,25 @@ Layout/FirstHashElementIndentation:
|
|||||||
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
||||||
Layout/HashAlignment:
|
Layout/HashAlignment:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/admin/subscriptions_controller.rb'
|
|
||||||
- 'app/controllers/spree/users_controller.rb'
|
- 'app/controllers/spree/users_controller.rb'
|
||||||
- 'app/models/spree/image.rb'
|
- 'app/models/spree/image.rb'
|
||||||
- 'spec/migrations/migrate_customer_names_spec.rb'
|
- 'spec/migrations/migrate_customer_names_spec.rb'
|
||||||
- 'spec/models/enterprise_spec.rb'
|
- 'spec/models/enterprise_spec.rb'
|
||||||
- 'spec/support/request/stripe_stubs.rb'
|
|
||||||
- 'spec/system/admin/customers_spec.rb'
|
- 'spec/system/admin/customers_spec.rb'
|
||||||
- 'spec/system/admin/order_spec.rb'
|
- 'spec/system/admin/order_spec.rb'
|
||||||
- 'spec/system/admin/orders_spec.rb'
|
- 'spec/system/admin/orders_spec.rb'
|
||||||
- 'spec/system/admin/tag_rules_spec.rb'
|
- 'spec/system/admin/tag_rules_spec.rb'
|
||||||
- 'spec/system/consumer/shopping/cart_spec.rb'
|
- 'spec/system/consumer/shopping/cart_spec.rb'
|
||||||
|
|
||||||
# Offense count: 18
|
# Offense count: 4
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
# SupportedStyles: normal, indented_internal_methods
|
# SupportedStyles: normal, indented_internal_methods
|
||||||
Layout/IndentationConsistency:
|
Layout/IndentationConsistency:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/system/admin/order_cycles/complex_editing_spec.rb'
|
|
||||||
- 'spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb'
|
- 'spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb'
|
||||||
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
||||||
- 'spec/system/admin/order_spec.rb'
|
|
||||||
- 'spec/system/admin/orders_spec.rb'
|
|
||||||
- 'spec/system/admin/product_import_spec.rb'
|
- 'spec/system/admin/product_import_spec.rb'
|
||||||
- 'spec/system/consumer/split_checkout_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
@@ -165,7 +179,64 @@ Layout/LeadingCommentSpace:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/system/admin/enterprises_spec.rb'
|
- 'spec/system/admin/enterprises_spec.rb'
|
||||||
|
|
||||||
# Offense count: 603
|
# Offense count: 114
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: space, no_space
|
||||||
|
Layout/LineContinuationSpacing:
|
||||||
|
Exclude:
|
||||||
|
- 'app/helpers/checkout_helper.rb'
|
||||||
|
- 'engines/order_management/spec/services/order_management/order/updater_spec.rb'
|
||||||
|
- 'engines/order_management/spec/services/order_management/subscriptions/stripe_payment_setup_spec.rb'
|
||||||
|
- 'engines/web/app/helpers/web/cookies_policy_helper.rb'
|
||||||
|
- 'spec/system/admin/bulk_order_management_spec.rb'
|
||||||
|
- 'spec/system/admin/configuration/content_spec.rb'
|
||||||
|
- 'spec/system/admin/customers_spec.rb'
|
||||||
|
- 'spec/system/admin/enterprise_fees_spec.rb'
|
||||||
|
- 'spec/system/admin/enterprises/index_spec.rb'
|
||||||
|
- 'spec/system/admin/enterprises_spec.rb'
|
||||||
|
- 'spec/system/admin/order_cycles/list_spec.rb'
|
||||||
|
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
||||||
|
- 'spec/system/admin/order_spec.rb'
|
||||||
|
- 'spec/system/admin/orders_spec.rb'
|
||||||
|
- 'spec/system/admin/overview_spec.rb'
|
||||||
|
- 'spec/system/admin/payment_method_spec.rb'
|
||||||
|
- 'spec/system/admin/product_import_spec.rb'
|
||||||
|
- 'spec/system/admin/subscriptions_spec.rb'
|
||||||
|
- 'spec/system/admin/tag_rules_spec.rb'
|
||||||
|
- 'spec/system/admin/users_spec.rb'
|
||||||
|
- 'spec/system/admin/variant_overrides_spec.rb'
|
||||||
|
- 'spec/system/consumer/authentication_spec.rb'
|
||||||
|
- 'spec/system/consumer/caching/shops_caching_spec.rb'
|
||||||
|
- 'spec/system/consumer/cookies_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/cart_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/checkout_auth_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/checkout_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/products_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/shopping_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/unit_price_spec.rb'
|
||||||
|
- 'spec/system/consumer/split_checkout_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 18
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||||
|
# SupportedStyles: aligned, indented
|
||||||
|
Layout/LineEndStringConcatenationIndentation:
|
||||||
|
Exclude:
|
||||||
|
- 'app/mailers/spree/user_mailer.rb'
|
||||||
|
- 'engines/order_management/app/services/order_management/subscriptions/proxy_order_syncer.rb'
|
||||||
|
- 'engines/order_management/spec/services/order_management/subscriptions/stripe_payment_setup_spec.rb'
|
||||||
|
- 'spec/system/admin/configuration/content_spec.rb'
|
||||||
|
- 'spec/system/admin/customers_spec.rb'
|
||||||
|
- 'spec/system/admin/overview_spec.rb'
|
||||||
|
- 'spec/system/admin/payment_method_spec.rb'
|
||||||
|
- 'spec/system/admin/subscriptions_spec.rb'
|
||||||
|
- 'spec/system/admin/tag_rules_spec.rb'
|
||||||
|
- 'spec/system/consumer/caching/shops_caching_spec.rb'
|
||||||
|
- 'spec/system/consumer/cookies_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/cart_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 605
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
||||||
# URISchemes: http, https
|
# URISchemes: http, https
|
||||||
@@ -378,7 +449,7 @@ Layout/TrailingEmptyLines:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'Rakefile'
|
- 'Rakefile'
|
||||||
|
|
||||||
# Offense count: 69
|
# Offense count: 67
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: AllowInHeredoc.
|
# Configuration parameters: AllowInHeredoc.
|
||||||
Layout/TrailingWhitespace:
|
Layout/TrailingWhitespace:
|
||||||
@@ -406,6 +477,16 @@ Layout/TrailingWhitespace:
|
|||||||
- 'spec/system/admin/shipping_methods_spec.rb'
|
- 'spec/system/admin/shipping_methods_spec.rb'
|
||||||
- 'spec/system/consumer/split_checkout_spec.rb'
|
- 'spec/system/consumer/split_checkout_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 7
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
Lint/AmbiguousOperatorPrecedence:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/calculator/flexi_rate.rb'
|
||||||
|
- 'app/models/enterprise.rb'
|
||||||
|
- 'app/models/spree/ability.rb'
|
||||||
|
- 'app/models/spree/line_item.rb'
|
||||||
|
- 'app/models/spree/preferences/store.rb'
|
||||||
|
|
||||||
# Offense count: 17
|
# Offense count: 17
|
||||||
# Configuration parameters: AllowedMethods.
|
# Configuration parameters: AllowedMethods.
|
||||||
# AllowedMethods: enums
|
# AllowedMethods: enums
|
||||||
@@ -424,6 +505,16 @@ Lint/ConstantDefinitionInBlock:
|
|||||||
- 'spec/validators/date_time_string_validator_spec.rb'
|
- 'spec/validators/date_time_string_validator_spec.rb'
|
||||||
- 'spec/validators/integer_array_validator_spec.rb'
|
- 'spec/validators/integer_array_validator_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 8
|
||||||
|
# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches.
|
||||||
|
Lint/DuplicateBranch:
|
||||||
|
Exclude:
|
||||||
|
- 'app/helpers/spree/admin/base_helper.rb'
|
||||||
|
- 'app/models/enterprise.rb'
|
||||||
|
- 'app/models/spree/calculator.rb'
|
||||||
|
- 'app/models/spree/preference.rb'
|
||||||
|
- 'app/models/spree/preferences/preferable.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
Lint/DuplicateMethods:
|
Lint/DuplicateMethods:
|
||||||
Exclude:
|
Exclude:
|
||||||
@@ -435,6 +526,30 @@ Lint/DuplicateRequire:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/lib/open_food_network/scope_variants_to_search_spec.rb'
|
- 'spec/lib/open_food_network/scope_variants_to_search_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 20
|
||||||
|
# Configuration parameters: AllowComments, AllowEmptyLambdas.
|
||||||
|
Lint/EmptyBlock:
|
||||||
|
Exclude:
|
||||||
|
- 'engines/catalog/config/routes.rb'
|
||||||
|
- 'spec/components/distributor_title_component_spec.rb'
|
||||||
|
- 'spec/components/example_component_spec.rb'
|
||||||
|
- 'spec/controllers/admin/subscription_line_items_controller_spec.rb'
|
||||||
|
- 'spec/controllers/api/v0/shipments_controller_spec.rb'
|
||||||
|
- 'spec/controllers/concerns/extra_fields_spec.rb'
|
||||||
|
- 'spec/factories.rb'
|
||||||
|
- 'spec/factories/enterprise_factory.rb'
|
||||||
|
- 'spec/jobs/order_cycle_opened_job_spec.rb'
|
||||||
|
- 'spec/jobs/subscription_placement_job_spec.rb'
|
||||||
|
- 'spec/models/product_import/entry_validator_spec.rb'
|
||||||
|
- 'spec/requests/checkout/concurrency_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 6
|
||||||
|
# Configuration parameters: AllowComments.
|
||||||
|
Lint/EmptyClass:
|
||||||
|
Exclude:
|
||||||
|
- 'spec/controllers/spree/admin/base_controller_spec.rb'
|
||||||
|
- 'spec/lib/reports/report_loader_spec.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: AllowComments.
|
# Configuration parameters: AllowComments.
|
||||||
Lint/EmptyFile:
|
Lint/EmptyFile:
|
||||||
@@ -452,6 +567,26 @@ Lint/IneffectiveAccessModifier:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/spree/user.rb'
|
- 'app/models/spree/user.rb'
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
Lint/NoReturnInBeginEndBlocks:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/payment_gateways/stripe_controller.rb'
|
||||||
|
|
||||||
|
# Offense count: 2
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
Lint/NonAtomicFileOperation:
|
||||||
|
Exclude:
|
||||||
|
- 'app/services/bulk_invoice_service.rb'
|
||||||
|
|
||||||
|
# Offense count: 4
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
Lint/RedundantDirGlobSort:
|
||||||
|
Exclude:
|
||||||
|
- 'engines/catalog/spec/spec_helper.rb'
|
||||||
|
- 'engines/dfc_provider/spec/spec_helper.rb'
|
||||||
|
- 'spec/base_spec_helper.rb'
|
||||||
|
- 'spec/system_helper.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: AllowedMethods.
|
# Configuration parameters: AllowedMethods.
|
||||||
@@ -482,14 +617,12 @@ Lint/UselessMethodDefinition:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/spree/gateway.rb'
|
- 'app/models/spree/gateway.rb'
|
||||||
|
|
||||||
# Offense count: 13
|
# Offense count: 3
|
||||||
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
||||||
Lint/Void:
|
Lint/Void:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/system/admin/order_cycles/complex_editing_spec.rb'
|
|
||||||
- 'spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb'
|
- 'spec/system/admin/order_cycles/complex_updating_specific_time_spec.rb'
|
||||||
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
- 'spec/system/admin/order_cycles/simple_spec.rb'
|
||||||
- 'spec/system/admin/order_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 27
|
# Offense count: 27
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
|
||||||
@@ -746,12 +879,6 @@ Naming/AccessorMethodName:
|
|||||||
- 'spec/support/request/shop_workflow.rb'
|
- 'spec/support/request/shop_workflow.rb'
|
||||||
- 'spec/support/request/web_helper.rb'
|
- 'spec/support/request/web_helper.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: AsciiConstants.
|
|
||||||
Naming/AsciiIdentifiers:
|
|
||||||
Exclude:
|
|
||||||
- 'spec/system/admin/products_spec.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: ForbiddenDelimiters.
|
# Configuration parameters: ForbiddenDelimiters.
|
||||||
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
||||||
@@ -791,6 +918,40 @@ Naming/VariableNumber:
|
|||||||
- 'spec/models/spree/tax_rate_spec.rb'
|
- 'spec/models/spree/tax_rate_spec.rb'
|
||||||
- 'spec/requests/api/orders_spec.rb'
|
- 'spec/requests/api/orders_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 9
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
# Configuration parameters: ExpectedOrder, Include.
|
||||||
|
# ExpectedOrder: index, show, new, edit, create, update, destroy
|
||||||
|
# Include: app/controllers/**/*.rb
|
||||||
|
Rails/ActionOrder:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/admin/resource_controller.rb'
|
||||||
|
- 'app/controllers/api/v0/orders_controller.rb'
|
||||||
|
- 'app/controllers/spree/admin/images_controller.rb'
|
||||||
|
- 'app/controllers/spree/admin/invoices_controller.rb'
|
||||||
|
- 'app/controllers/spree/admin/products_controller.rb'
|
||||||
|
- 'app/controllers/spree/admin/taxons_controller.rb'
|
||||||
|
- 'app/controllers/spree/admin/variants_controller.rb'
|
||||||
|
- 'app/controllers/user_confirmations_controller.rb'
|
||||||
|
|
||||||
|
# Offense count: 15
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: app/models/**/*.rb
|
||||||
|
Rails/ActiveRecordCallbacksOrder:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/customer.rb'
|
||||||
|
- 'app/models/enterprise.rb'
|
||||||
|
- 'app/models/enterprise_group.rb'
|
||||||
|
- 'app/models/enterprise_relationship.rb'
|
||||||
|
- 'app/models/spree/line_item.rb'
|
||||||
|
- 'app/models/spree/order.rb'
|
||||||
|
- 'app/models/spree/payment.rb'
|
||||||
|
- 'app/models/spree/product.rb'
|
||||||
|
- 'app/models/spree/return_authorization.rb'
|
||||||
|
- 'app/models/spree/user.rb'
|
||||||
|
- 'app/models/spree/variant.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: Severity, Include.
|
# Configuration parameters: Severity, Include.
|
||||||
# Include: app/models/**/*.rb
|
# Include: app/models/**/*.rb
|
||||||
@@ -810,12 +971,6 @@ Rails/ApplicationJob:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'app/jobs/report_job.rb'
|
- 'app/jobs/report_job.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
Rails/ApplicationMailer:
|
|
||||||
Exclude:
|
|
||||||
- 'app/mailers/spree/base_mailer.rb'
|
|
||||||
|
|
||||||
# Offense count: 5
|
# Offense count: 5
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent.
|
# Configuration parameters: NilOrEmpty, NotPresent, UnlessPresent.
|
||||||
@@ -826,6 +981,45 @@ Rails/Blank:
|
|||||||
- 'engines/order_management/app/services/order_management/stock/package.rb'
|
- 'engines/order_management/app/services/order_management/stock/package.rb'
|
||||||
- 'lib/stripe/authorize_response_patcher.rb'
|
- 'lib/stripe/authorize_response_patcher.rb'
|
||||||
|
|
||||||
|
# Offense count: 17
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
Rails/CompactBlank:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/spree/admin/users_controller.rb'
|
||||||
|
- 'app/models/concerns/address_display.rb'
|
||||||
|
- 'app/models/spree/zone.rb'
|
||||||
|
- 'app/services/order_cycle_form.rb'
|
||||||
|
- 'lib/reporting/report_headers_builder.rb'
|
||||||
|
- 'lib/reporting/report_ruler.rb'
|
||||||
|
- 'lib/reporting/reports/enterprise_fee_summary/parameters.rb'
|
||||||
|
|
||||||
|
# Offense count: 2
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
Rails/DotSeparatedKeys:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/api/v1/base_controller.rb'
|
||||||
|
|
||||||
|
# Offense count: 27
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
Rails/DurationArithmetic:
|
||||||
|
Exclude:
|
||||||
|
- 'app/services/create_order_cycle.rb'
|
||||||
|
- 'spec/jobs/order_cycle_closing_job_spec.rb'
|
||||||
|
- 'spec/jobs/order_cycle_opened_job_spec.rb'
|
||||||
|
- 'spec/services/permissions/order_spec.rb'
|
||||||
|
- 'spec/services/terms_of_service_spec.rb'
|
||||||
|
- 'spec/system/admin/bulk_order_management_spec.rb'
|
||||||
|
- 'spec/system/admin/order_cycles/list_spec.rb'
|
||||||
|
- 'spec/system/admin/orders_spec.rb'
|
||||||
|
- 'spec/system/admin/reports/orders_and_fulfillment_spec.rb'
|
||||||
|
- 'spec/system/admin/reports/packing_report_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
Rails/ExpandedDateRange:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/spree/product.rb'
|
||||||
|
|
||||||
# Offense count: 5
|
# Offense count: 5
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
# SupportedStyles: slashes, arguments
|
# SupportedStyles: slashes, arguments
|
||||||
@@ -894,17 +1088,38 @@ Rails/HelperInstanceVariable:
|
|||||||
- 'app/helpers/spree/admin/orders_helper.rb'
|
- 'app/helpers/spree/admin/orders_helper.rb'
|
||||||
- 'app/helpers/spree/orders_helper.rb'
|
- 'app/helpers/spree/orders_helper.rb'
|
||||||
|
|
||||||
# Offense count: 37
|
# Offense count: 2
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: app/controllers/**/*.rb
|
||||||
|
Rails/I18nLazyLookup:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/admin/proxy_orders_controller.rb'
|
||||||
|
|
||||||
|
# Offense count: 8
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: spec/**/*.rb, test/**/*.rb
|
||||||
|
Rails/I18nLocaleAssignment:
|
||||||
|
Exclude:
|
||||||
|
- 'spec/controllers/user_registrations_controller_spec.rb'
|
||||||
|
- 'spec/helpers/i18n_helper_spec.rb'
|
||||||
|
- 'spec/models/spree/variant_spec.rb'
|
||||||
|
- 'spec/system/admin/order_cycles/list_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 3
|
||||||
|
Rails/I18nLocaleTexts:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/admin/stripe_accounts_controller.rb'
|
||||||
|
|
||||||
|
# Offense count: 27
|
||||||
# Configuration parameters: IgnoreScopes, Include.
|
# Configuration parameters: IgnoreScopes, Include.
|
||||||
# Include: app/models/**/*.rb
|
# Include: app/models/**/*.rb
|
||||||
Rails/InverseOf:
|
Rails/InverseOf:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/concerns/calculated_adjustments.rb'
|
|
||||||
- 'app/models/enterprise.rb'
|
- 'app/models/enterprise.rb'
|
||||||
- 'app/models/order_cycle.rb'
|
- 'app/models/order_cycle.rb'
|
||||||
- 'app/models/spree/adjustment.rb'
|
- 'app/models/spree/adjustment.rb'
|
||||||
- 'app/models/spree/country.rb'
|
- 'app/models/spree/country.rb'
|
||||||
- 'app/models/spree/credit_card.rb'
|
|
||||||
- 'app/models/spree/inventory_unit.rb'
|
- 'app/models/spree/inventory_unit.rb'
|
||||||
- 'app/models/spree/line_item.rb'
|
- 'app/models/spree/line_item.rb'
|
||||||
- 'app/models/spree/option_type.rb'
|
- 'app/models/spree/option_type.rb'
|
||||||
@@ -912,9 +1127,7 @@ Rails/InverseOf:
|
|||||||
- 'app/models/spree/payment.rb'
|
- 'app/models/spree/payment.rb'
|
||||||
- 'app/models/spree/price.rb'
|
- 'app/models/spree/price.rb'
|
||||||
- 'app/models/spree/product.rb'
|
- 'app/models/spree/product.rb'
|
||||||
- 'app/models/spree/shipment.rb'
|
|
||||||
- 'app/models/spree/stock_item.rb'
|
- 'app/models/spree/stock_item.rb'
|
||||||
- 'app/models/spree/tax_rate.rb'
|
|
||||||
- 'app/models/spree/taxonomy.rb'
|
- 'app/models/spree/taxonomy.rb'
|
||||||
- 'app/models/spree/variant.rb'
|
- 'app/models/spree/variant.rb'
|
||||||
- 'app/models/subscription_line_item.rb'
|
- 'app/models/subscription_line_item.rb'
|
||||||
@@ -944,6 +1157,19 @@ Rails/LexicallyScopedActionFilter:
|
|||||||
- 'app/controllers/spree/admin/zones_controller.rb'
|
- 'app/controllers/spree/admin/zones_controller.rb'
|
||||||
- 'app/controllers/spree/users_controller.rb'
|
- 'app/controllers/spree/users_controller.rb'
|
||||||
|
|
||||||
|
# Offense count: 9
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
Rails/NegateInclude:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/admin/resource_controller.rb'
|
||||||
|
- 'app/models/calculator/weight.rb'
|
||||||
|
- 'app/models/product_import/spreadsheet_entry.rb'
|
||||||
|
- 'app/models/spree/order/checkout.rb'
|
||||||
|
- 'app/services/order_cart_reset.rb'
|
||||||
|
- 'engines/order_management/app/services/order_management/stock/estimator.rb'
|
||||||
|
- 'lib/spree/localized_number.rb'
|
||||||
|
- 'spec/support/matchers/table_matchers.rb'
|
||||||
|
|
||||||
# Offense count: 18
|
# Offense count: 18
|
||||||
Rails/OutputSafety:
|
Rails/OutputSafety:
|
||||||
Exclude:
|
Exclude:
|
||||||
@@ -959,12 +1185,112 @@ Rails/OutputSafety:
|
|||||||
- 'lib/reporting/queries/query_interface.rb'
|
- 'lib/reporting/queries/query_interface.rb'
|
||||||
- 'lib/spree/money.rb'
|
- 'lib/spree/money.rb'
|
||||||
|
|
||||||
|
# Offense count: 29
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
Rails/Pluck:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/admin/variant_overrides_controller.rb'
|
||||||
|
- 'app/helpers/shop_helper.rb'
|
||||||
|
- 'app/services/cart_service.rb'
|
||||||
|
- 'app/services/sets/product_set.rb'
|
||||||
|
- 'lib/reporting/report_headers_builder.rb'
|
||||||
|
- 'spec/controllers/admin/bulk_line_items_controller_spec.rb'
|
||||||
|
- 'spec/controllers/admin/subscriptions_controller_spec.rb'
|
||||||
|
- 'spec/controllers/api/v0/order_cycles_controller_spec.rb'
|
||||||
|
- 'spec/controllers/api/v0/orders_controller_spec.rb'
|
||||||
|
- 'spec/controllers/api/v0/products_controller_spec.rb'
|
||||||
|
- 'spec/controllers/api/v0/shops_controller_spec.rb'
|
||||||
|
- 'spec/controllers/api/v0/states_controller_spec.rb'
|
||||||
|
- 'spec/controllers/api/v0/taxons_controller_spec.rb'
|
||||||
|
- 'spec/helpers/spree/admin/orders_helper_spec.rb'
|
||||||
|
- 'spec/lib/reports/lettuce_share_report_spec.rb'
|
||||||
|
- 'spec/lib/reports/users_and_enterprises_report_spec.rb'
|
||||||
|
- 'spec/serializers/api/admin/for_order_cycle/supplied_product_serializer_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: conservative, aggressive
|
||||||
|
Rails/PluckInWhere:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/spree/variant.rb'
|
||||||
|
|
||||||
|
# Offense count: 28
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
Rails/RedundantPresenceValidationOnBelongsTo:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/enterprise.rb'
|
||||||
|
- 'app/models/enterprise_fee.rb'
|
||||||
|
- 'app/models/enterprise_group.rb'
|
||||||
|
- 'app/models/enterprise_relationship.rb'
|
||||||
|
- 'app/models/enterprise_role.rb'
|
||||||
|
- 'app/models/exchange.rb'
|
||||||
|
- 'app/models/inventory_item.rb'
|
||||||
|
- 'app/models/order_cycle.rb'
|
||||||
|
- 'app/models/spree/address.rb'
|
||||||
|
- 'app/models/spree/line_item.rb'
|
||||||
|
- 'app/models/spree/order.rb'
|
||||||
|
- 'app/models/spree/product.rb'
|
||||||
|
- 'app/models/spree/product_property.rb'
|
||||||
|
- 'app/models/spree/return_authorization.rb'
|
||||||
|
- 'app/models/spree/state.rb'
|
||||||
|
- 'app/models/spree/stock_item.rb'
|
||||||
|
- 'app/models/spree/stock_movement.rb'
|
||||||
|
- 'app/models/spree/tax_rate.rb'
|
||||||
|
- 'app/models/subscription_line_item.rb'
|
||||||
|
- 'app/models/tag_rule.rb'
|
||||||
|
- 'app/models/variant_override.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
Rails/RelativeDateConstant:
|
Rails/RelativeDateConstant:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/tasks/data/remove_transient_data.rb'
|
- 'lib/tasks/data/remove_transient_data.rb'
|
||||||
|
|
||||||
|
# Offense count: 58
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: spec/controllers/**/*.rb, spec/requests/**/*.rb, test/controllers/**/*.rb, test/integration/**/*.rb
|
||||||
|
Rails/ResponseParsedBody:
|
||||||
|
Exclude:
|
||||||
|
- 'spec/controllers/admin/bulk_line_items_controller_spec.rb'
|
||||||
|
- 'spec/controllers/admin/customers_controller_spec.rb'
|
||||||
|
- 'spec/controllers/admin/order_cycles_controller_spec.rb'
|
||||||
|
- 'spec/controllers/admin/proxy_orders_controller_spec.rb'
|
||||||
|
- 'spec/controllers/admin/schedules_controller_spec.rb'
|
||||||
|
- 'spec/controllers/admin/stripe_accounts_controller_spec.rb'
|
||||||
|
- 'spec/controllers/admin/subscription_line_items_controller_spec.rb'
|
||||||
|
- 'spec/controllers/admin/subscriptions_controller_spec.rb'
|
||||||
|
- 'spec/controllers/cart_controller_spec.rb'
|
||||||
|
- 'spec/controllers/line_items_controller_spec.rb'
|
||||||
|
- 'spec/controllers/spree/admin/search_controller_spec.rb'
|
||||||
|
- 'spec/controllers/spree/credit_cards_controller_spec.rb'
|
||||||
|
- 'spec/controllers/user_registrations_controller_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 4
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
Rails/RootPathnameMethods:
|
||||||
|
Exclude:
|
||||||
|
- 'spec/lib/reports/orders_and_fulfillment/order_cycle_customer_totals_report_spec.rb'
|
||||||
|
- 'spec/models/content_configuration_spec.rb'
|
||||||
|
- 'spec/models/terms_of_service_file_spec.rb'
|
||||||
|
- 'spec/system/admin/configuration/terms_of_service_files_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 13
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
Rails/RootPublicPath:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/concerns/request_timeouts.rb'
|
||||||
|
- 'lib/spree/core/controller_helpers/common.rb'
|
||||||
|
- 'spec/controllers/api/v0/product_images_controller_spec.rb'
|
||||||
|
- 'spec/controllers/api/v0/terms_and_conditions_controller_spec.rb'
|
||||||
|
- 'spec/models/terms_of_service_file_spec.rb'
|
||||||
|
- 'spec/system/admin/bulk_product_update_spec.rb'
|
||||||
|
- 'spec/system/admin/enterprises/terms_and_conditions_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/checkout_spec.rb'
|
||||||
|
- 'spec/system/consumer/shopping/embedded_groups_spec.rb'
|
||||||
|
- 'spec/system/consumer/split_checkout_spec.rb'
|
||||||
|
|
||||||
# Offense count: 4
|
# Offense count: 4
|
||||||
# Configuration parameters: ForbiddenMethods, AllowedMethods.
|
# Configuration parameters: ForbiddenMethods, AllowedMethods.
|
||||||
# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all
|
# ForbiddenMethods: decrement!, decrement_counter, increment!, increment_counter, insert, insert!, insert_all, insert_all!, toggle!, touch, touch_all, update_all, update_attribute, update_column, update_columns, update_counters, upsert, upsert_all
|
||||||
@@ -973,6 +1299,24 @@ Rails/SkipsModelValidations:
|
|||||||
- 'app/models/variant_override.rb'
|
- 'app/models/variant_override.rb'
|
||||||
- 'spec/models/spree/line_item_spec.rb'
|
- 'spec/models/spree/line_item_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 3
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
Rails/SquishedSQLHeredocs:
|
||||||
|
Exclude:
|
||||||
|
- 'app/queries/customers_with_balance.rb'
|
||||||
|
- 'app/queries/outstanding_balance.rb'
|
||||||
|
- 'spec/queries/outstanding_balance_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 24
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
Rails/StripHeredoc:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/content_configuration.rb'
|
||||||
|
- 'app/queries/customers_with_balance.rb'
|
||||||
|
- 'app/queries/outstanding_balance.rb'
|
||||||
|
- 'lib/reporting/reports/enterprise_fee_summary/scope.rb'
|
||||||
|
- 'lib/tasks/data/truncate_data.rake'
|
||||||
|
|
||||||
# Offense count: 4
|
# Offense count: 4
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
@@ -984,6 +1328,11 @@ Rails/TimeZone:
|
|||||||
- 'spec/models/spree/tax_rate_spec.rb'
|
- 'spec/models/spree/tax_rate_spec.rb'
|
||||||
- 'spec/services/customer_order_cancellation_spec.rb'
|
- 'spec/services/customer_order_cancellation_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
Rails/TransactionExitStatement:
|
||||||
|
Exclude:
|
||||||
|
- 'app/services/place_proxy_order.rb'
|
||||||
|
|
||||||
# Offense count: 5
|
# Offense count: 5
|
||||||
# Configuration parameters: Include.
|
# Configuration parameters: Include.
|
||||||
# Include: app/models/**/*.rb
|
# Include: app/models/**/*.rb
|
||||||
@@ -1002,6 +1351,77 @@ Rails/UnknownEnv:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/spree/app_configuration.rb'
|
- 'app/models/spree/app_configuration.rb'
|
||||||
|
|
||||||
|
# Offense count: 55
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
Rails/WhereEquals:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/spree/admin/products_controller.rb'
|
||||||
|
- 'app/mailers/producer_mailer.rb'
|
||||||
|
- 'app/models/enterprise.rb'
|
||||||
|
- 'app/models/enterprise_fee.rb'
|
||||||
|
- 'app/models/enterprise_group.rb'
|
||||||
|
- 'app/models/enterprise_relationship.rb'
|
||||||
|
- 'app/models/exchange.rb'
|
||||||
|
- 'app/models/order_cycle.rb'
|
||||||
|
- 'app/models/product_import/entry_processor.rb'
|
||||||
|
- 'app/models/proxy_order.rb'
|
||||||
|
- 'app/models/schedule.rb'
|
||||||
|
- 'app/models/spree/line_item.rb'
|
||||||
|
- 'app/models/spree/order.rb'
|
||||||
|
- 'app/models/spree/payment_method.rb'
|
||||||
|
- 'app/models/spree/product.rb'
|
||||||
|
- 'app/models/spree/shipping_method.rb'
|
||||||
|
- 'app/models/spree/variant.rb'
|
||||||
|
- 'app/models/subscription.rb'
|
||||||
|
- 'app/queries/payments_requiring_action.rb'
|
||||||
|
- 'app/serializers/api/enterprise_shopfront_serializer.rb'
|
||||||
|
- 'app/serializers/api/order_serializer.rb'
|
||||||
|
- 'lib/open_food_network/enterprise_fee_calculator.rb'
|
||||||
|
- 'lib/open_food_network/order_cycle_permissions.rb'
|
||||||
|
- 'lib/reporting/reports/customers/base.rb'
|
||||||
|
- 'lib/reporting/reports/products_and_inventory/base.rb'
|
||||||
|
- 'lib/tasks/data.rake'
|
||||||
|
- 'lib/tasks/data/anonymize_data.rake'
|
||||||
|
- 'lib/tasks/data/remove_transient_data.rb'
|
||||||
|
- 'spec/services/product_tag_rules_filterer_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 8
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: exists, where
|
||||||
|
Rails/WhereExists:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/spree/admin/overview_controller.rb'
|
||||||
|
- 'app/controllers/spree/admin/tax_rates_controller.rb'
|
||||||
|
- 'app/controllers/spree/user_sessions_controller.rb'
|
||||||
|
- 'app/models/spree/preferences/store.rb'
|
||||||
|
- 'lib/tasks/sample_data/customer_factory.rb'
|
||||||
|
- 'lib/tasks/sample_data/group_factory.rb'
|
||||||
|
- 'lib/tasks/sample_data/order_cycle_factory.rb'
|
||||||
|
- 'lib/tasks/sample_data/taxon_factory.rb'
|
||||||
|
|
||||||
|
# Offense count: 24
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
Rails/WhereNot:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/spree/admin/products_controller.rb'
|
||||||
|
- 'app/models/concerns/permalink_generator.rb'
|
||||||
|
- 'app/models/enterprise.rb'
|
||||||
|
- 'app/models/enterprise_fee.rb'
|
||||||
|
- 'app/models/enterprise_relationship.rb'
|
||||||
|
- 'app/models/product_import/inventory_reset_strategy.rb'
|
||||||
|
- 'app/models/proxy_order.rb'
|
||||||
|
- 'app/models/spree/credit_card.rb'
|
||||||
|
- 'app/models/spree/product.rb'
|
||||||
|
- 'app/models/spree/variant.rb'
|
||||||
|
- 'app/models/spree/zone.rb'
|
||||||
|
- 'app/models/variant_override.rb'
|
||||||
|
- 'app/services/cap_quantity.rb'
|
||||||
|
- 'engines/catalog/app/services/catalog/product_import/products_reset_strategy.rb'
|
||||||
|
- 'engines/order_management/app/services/order_management/subscriptions/proxy_order_syncer.rb'
|
||||||
|
- 'lib/reporting/reports/users_and_enterprises/base.rb'
|
||||||
|
- 'lib/tasks/data/anonymize_data.rake'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
Security/Open:
|
Security/Open:
|
||||||
Exclude:
|
Exclude:
|
||||||
@@ -1020,14 +1440,6 @@ Style/CaseEquality:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/models/spree/payment_spec.rb'
|
- 'spec/models/spree/payment_spec.rb'
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
Style/CaseLikeIf:
|
|
||||||
Exclude:
|
|
||||||
- 'app/controllers/admin/order_cycles_controller.rb'
|
|
||||||
- 'app/models/calculator/weight.rb'
|
|
||||||
- 'app/models/spree/payment/processing.rb'
|
|
||||||
|
|
||||||
# Offense count: 25
|
# Offense count: 25
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
@@ -1063,6 +1475,27 @@ Style/ClassVars:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/spree/core/delegate_belongs_to.rb'
|
- 'lib/spree/core/delegate_belongs_to.rb'
|
||||||
|
|
||||||
|
# Offense count: 9
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
# Configuration parameters: AllowedVars.
|
||||||
|
Style/FetchEnvVar:
|
||||||
|
Exclude:
|
||||||
|
- 'app/helpers/discourse_helper.rb'
|
||||||
|
- 'app/models/spree/preferences/configuration.rb'
|
||||||
|
- 'app/models/spree/preferences/preferable.rb'
|
||||||
|
- 'app/services/default_country.rb'
|
||||||
|
- 'spec/base_spec_helper.rb'
|
||||||
|
- 'spec/controllers/spree/credit_cards_controller_spec.rb'
|
||||||
|
- 'spec/models/order_balance_spec.rb'
|
||||||
|
- 'spec/support/vcr_setup.rb'
|
||||||
|
|
||||||
|
# Offense count: 2
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
Style/FileRead:
|
||||||
|
Exclude:
|
||||||
|
- 'lib/tasks/karma.rake'
|
||||||
|
- 'spec/services/upload_sanitizer_spec.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
|
# Configuration parameters: MaxUnannotatedPlaceholdersAllowed, AllowedMethods, AllowedPatterns.
|
||||||
@@ -1117,27 +1550,36 @@ Style/GuardClause:
|
|||||||
- 'spec/support/request/shop_workflow.rb'
|
- 'spec/support/request/shop_workflow.rb'
|
||||||
- 'spec/system/support/precompile_assets.rb'
|
- 'spec/system/support/precompile_assets.rb'
|
||||||
|
|
||||||
|
# Offense count: 12
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
# Configuration parameters: AllowSplatArgument.
|
||||||
|
Style/HashConversion:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/admin/column_preferences_controller.rb'
|
||||||
|
- 'app/controllers/admin/variant_overrides_controller.rb'
|
||||||
|
- 'app/controllers/spree/admin/products_controller.rb'
|
||||||
|
- 'app/models/order_cycle.rb'
|
||||||
|
- 'app/models/product_import/product_importer.rb'
|
||||||
|
- 'app/models/spree/shipping_method.rb'
|
||||||
|
- 'app/serializers/api/admin/exchange_serializer.rb'
|
||||||
|
- 'app/services/variants_stock_levels.rb'
|
||||||
|
- 'spec/controllers/admin/inventory_items_controller_spec.rb'
|
||||||
|
- 'spec/controllers/admin/variant_overrides_controller_spec.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: MinBranchesCount.
|
# Configuration parameters: MinBranchesCount.
|
||||||
Style/HashLikeCase:
|
Style/HashLikeCase:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/enterprise.rb'
|
- 'app/models/enterprise.rb'
|
||||||
|
|
||||||
# Offense count: 11
|
# Offense count: 4
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
# Configuration parameters: InverseMethods, InverseBlocks.
|
Style/MapToHash:
|
||||||
Style/InverseMethods:
|
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/admin/resource_controller.rb'
|
- 'lib/reporting/report_query_template.rb'
|
||||||
- 'app/models/calculator/weight.rb'
|
- 'lib/reporting/report_row_builder.rb'
|
||||||
- 'app/models/product_import/spreadsheet_entry.rb'
|
- 'lib/reporting/reports/enterprise_fee_summary/base.rb'
|
||||||
- 'app/models/spree/order/checkout.rb'
|
- 'lib/tasks/sample_data/user_factory.rb'
|
||||||
- 'app/models/spree/order_contents.rb'
|
|
||||||
- 'app/models/spree/payment.rb'
|
|
||||||
- 'app/services/order_cart_reset.rb'
|
|
||||||
- 'engines/order_management/app/services/order_management/stock/estimator.rb'
|
|
||||||
- 'lib/spree/localized_number.rb'
|
|
||||||
- 'spec/support/matchers/table_matchers.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
Style/MissingRespondToMissing:
|
Style/MissingRespondToMissing:
|
||||||
@@ -1152,6 +1594,13 @@ Style/MultilineTernaryOperator:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/system/admin/subscriptions_spec.rb'
|
- 'spec/system/admin/subscriptions_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 2
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
Style/NegatedIfElseCondition:
|
||||||
|
Exclude:
|
||||||
|
- 'app/mailers/spree/shipment_mailer.rb'
|
||||||
|
- 'spec/support/matchers/table_matchers.rb'
|
||||||
|
|
||||||
# Offense count: 22
|
# Offense count: 22
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
Style/NestedModifier:
|
Style/NestedModifier:
|
||||||
@@ -1167,13 +1616,18 @@ Style/NestedModifier:
|
|||||||
- 'spec/system/admin/payments_stripe_spec.rb'
|
- 'spec/system/admin/payments_stripe_spec.rb'
|
||||||
- 'spec/system/admin/reports_spec.rb'
|
- 'spec/system/admin/reports_spec.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 36
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
Style/OpenStructUse:
|
||||||
# Configuration parameters: AllowedMethods.
|
|
||||||
# AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with
|
|
||||||
Style/NestedParenthesizedCalls:
|
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'spec/system/admin/products_spec.rb'
|
- 'app/helpers/injection_helper.rb'
|
||||||
|
- 'app/models/spree/shipment.rb'
|
||||||
|
- 'lib/open_food_network/enterprise_fee_calculator.rb'
|
||||||
|
- 'lib/reporting/report_row_builder.rb'
|
||||||
|
- 'lib/reporting/report_rows_builder.rb'
|
||||||
|
- 'spec/lib/reports/report_renderer_spec.rb'
|
||||||
|
- 'spec/lib/reports/report_spec.rb'
|
||||||
|
- 'spec/lib/reports/users_and_enterprises_report_spec.rb'
|
||||||
|
- 'spec/serializers/api/enterprise_serializer_spec.rb'
|
||||||
|
|
||||||
# Offense count: 16
|
# Offense count: 16
|
||||||
# Configuration parameters: AllowedMethods.
|
# Configuration parameters: AllowedMethods.
|
||||||
@@ -1207,12 +1661,70 @@ Style/PreferredHashMethods:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'app/controllers/api/v0/shipments_controller.rb'
|
- 'app/controllers/api/v0/shipments_controller.rb'
|
||||||
|
|
||||||
|
# Offense count: 16
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: same_as_string_literals, single_quotes, double_quotes
|
||||||
|
Style/QuotedSymbols:
|
||||||
|
Exclude:
|
||||||
|
- 'app/services/exchange_products_renderer.rb'
|
||||||
|
- 'lib/stripe/credit_card_cloner.rb'
|
||||||
|
- 'spec/controllers/api/v0/exchange_products_controller_spec.rb'
|
||||||
|
- 'spec/requests/api/orders_spec.rb'
|
||||||
|
- 'spec/requests/api/v1/customers_spec.rb'
|
||||||
|
- 'spec/support/request/stripe_stubs.rb'
|
||||||
|
|
||||||
|
# Offense count: 3
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
# Configuration parameters: Methods.
|
||||||
|
Style/RedundantArgument:
|
||||||
|
Exclude:
|
||||||
|
- 'engines/dfc_provider/app/services/authorization_control.rb'
|
||||||
|
- 'spec/support/query_counter.rb'
|
||||||
|
|
||||||
|
# Offense count: 15
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
Style/RedundantConstantBase:
|
||||||
|
Exclude:
|
||||||
|
- 'app/controllers/checkout_controller.rb'
|
||||||
|
- 'app/controllers/split_checkout_controller.rb'
|
||||||
|
- 'app/controllers/webhook_endpoints_controller.rb'
|
||||||
|
- 'config.ru'
|
||||||
|
- 'spec/base_spec_helper.rb'
|
||||||
|
- 'spec/helpers/checkout_helper_spec.rb'
|
||||||
|
- 'spec/models/spree/order_spec.rb'
|
||||||
|
- 'spec/models/spree/payment_method_spec.rb'
|
||||||
|
- 'spec/models/spree/payment_spec.rb'
|
||||||
|
- 'spec/queries/complete_visible_orders_spec.rb'
|
||||||
|
- 'spec/services/paypal_items_builder_spec.rb'
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
Style/RedundantDoubleSplatHashBraces:
|
||||||
|
Exclude:
|
||||||
|
- 'spec/system/support/cuprite_setup.rb'
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
# This cop supports unsafe autocorrection (--autocorrect-all).
|
||||||
|
# Configuration parameters: AllowComments.
|
||||||
|
Style/RedundantInitialize:
|
||||||
|
Exclude:
|
||||||
|
- 'spec/models/spree/gateway_spec.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
Style/RedundantRegexpEscape:
|
Style/RedundantRegexpEscape:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'app/models/spree/order.rb'
|
- 'app/models/spree/order.rb'
|
||||||
|
|
||||||
|
# Offense count: 4
|
||||||
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
|
Style/RedundantStringEscape:
|
||||||
|
Exclude:
|
||||||
|
- 'app/models/spree/calculator.rb'
|
||||||
|
- 'spec/controllers/spree/admin/shipping_methods_controller_spec.rb'
|
||||||
|
- 'spec/system/admin/enterprise_fees_spec.rb'
|
||||||
|
|
||||||
# Offense count: 206
|
# Offense count: 206
|
||||||
Style/Send:
|
Style/Send:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ TL;DR:
|
|||||||
* Maintain a clean commit history
|
* Maintain a clean commit history
|
||||||
* Use a style consistent with the rest of the codebase
|
* Use a style consistent with the rest of the codebase
|
||||||
* Before submitting, [rebase your work][rebase] on the current master branch
|
* Before submitting, [rebase your work][rebase] on the current master branch
|
||||||
|
* After submitting, be sure to check the [CI test results](ci). Click on a ❌ result to view the logged results and investigate.
|
||||||
|
|
||||||
From here, your pull request will progress through the [Review, Test, Merge & Deploy process][process].
|
From here, your pull request will progress through the [Review, Test, Merge & Deploy process][process].
|
||||||
|
|
||||||
@@ -71,3 +72,4 @@ From here, your pull request will progress through the [Review, Test, Merge & De
|
|||||||
[ofn-transifex]: https://www.transifex.com/open-food-foundation/open-food-network/
|
[ofn-transifex]: https://www.transifex.com/open-food-foundation/open-food-network/
|
||||||
[i18n]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Internationalisation-%28i18n%29
|
[i18n]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Internationalisation-%28i18n%29
|
||||||
[welcome-dev]: https://github.com/orgs/openfoodfoundation/projects/2
|
[welcome-dev]: https://github.com/orgs/openfoodfoundation/projects/2
|
||||||
|
[ci]: https://github.com/openfoodfoundation/openfoodnetwork/wiki/Continuous-Integration
|
||||||
|
|||||||
2
Gemfile
2
Gemfile
@@ -92,6 +92,7 @@ gem 'gmaps4rails'
|
|||||||
gem 'mimemagic', '> 0.3.5'
|
gem 'mimemagic', '> 0.3.5'
|
||||||
gem 'paper_trail', '~> 12.1'
|
gem 'paper_trail', '~> 12.1'
|
||||||
gem 'rack-rewrite'
|
gem 'rack-rewrite'
|
||||||
|
gem 'rack-timeout'
|
||||||
gem 'roadie-rails'
|
gem 'roadie-rails'
|
||||||
|
|
||||||
gem 'hiredis'
|
gem 'hiredis'
|
||||||
@@ -141,7 +142,6 @@ gem "private_address_check"
|
|||||||
|
|
||||||
group :production, :staging do
|
group :production, :staging do
|
||||||
gem 'ddtrace'
|
gem 'ddtrace'
|
||||||
gem 'rack-timeout'
|
|
||||||
gem 'sd_notify' # For better Systemd process management. Used by Puma.
|
gem 'sd_notify' # For better Systemd process management. Used by Puma.
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
24
Gemfile.lock
24
Gemfile.lock
@@ -157,7 +157,7 @@ GEM
|
|||||||
awesome_nested_set (3.5.0)
|
awesome_nested_set (3.5.0)
|
||||||
activerecord (>= 4.0.0, < 7.1)
|
activerecord (>= 4.0.0, < 7.1)
|
||||||
aws-eventstream (1.2.0)
|
aws-eventstream (1.2.0)
|
||||||
aws-partitions (1.739.0)
|
aws-partitions (1.742.0)
|
||||||
aws-sdk-core (3.171.0)
|
aws-sdk-core (3.171.0)
|
||||||
aws-eventstream (~> 1, >= 1.0.2)
|
aws-eventstream (~> 1, >= 1.0.2)
|
||||||
aws-partitions (~> 1, >= 1.651.0)
|
aws-partitions (~> 1, >= 1.651.0)
|
||||||
@@ -166,7 +166,7 @@ GEM
|
|||||||
aws-sdk-kms (1.63.0)
|
aws-sdk-kms (1.63.0)
|
||||||
aws-sdk-core (~> 3, >= 3.165.0)
|
aws-sdk-core (~> 3, >= 3.165.0)
|
||||||
aws-sigv4 (~> 1.1)
|
aws-sigv4 (~> 1.1)
|
||||||
aws-sdk-s3 (1.120.0)
|
aws-sdk-s3 (1.120.1)
|
||||||
aws-sdk-core (~> 3, >= 3.165.0)
|
aws-sdk-core (~> 3, >= 3.165.0)
|
||||||
aws-sdk-kms (~> 1)
|
aws-sdk-kms (~> 1)
|
||||||
aws-sigv4 (~> 1.4)
|
aws-sigv4 (~> 1.4)
|
||||||
@@ -219,7 +219,7 @@ GEM
|
|||||||
matrix
|
matrix
|
||||||
ruby-rc4 (>= 0.1.5)
|
ruby-rc4 (>= 0.1.5)
|
||||||
concurrent-ruby (1.2.2)
|
concurrent-ruby (1.2.2)
|
||||||
connection_pool (2.3.0)
|
connection_pool (2.4.0)
|
||||||
crack (0.4.5)
|
crack (0.4.5)
|
||||||
rexml
|
rexml
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
@@ -425,8 +425,8 @@ GEM
|
|||||||
timeout
|
timeout
|
||||||
net-smtp (0.3.3)
|
net-smtp (0.3.3)
|
||||||
net-protocol
|
net-protocol
|
||||||
nio4r (2.5.8)
|
nio4r (2.5.9)
|
||||||
nokogiri (1.14.2)
|
nokogiri (1.14.3)
|
||||||
mini_portile2 (~> 2.8.0)
|
mini_portile2 (~> 2.8.0)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
oauth2 (1.4.11)
|
oauth2 (1.4.11)
|
||||||
@@ -485,7 +485,7 @@ GEM
|
|||||||
coderay (~> 1.1)
|
coderay (~> 1.1)
|
||||||
method_source (~> 1.0)
|
method_source (~> 1.0)
|
||||||
public_suffix (5.0.1)
|
public_suffix (5.0.1)
|
||||||
puma (6.2.1)
|
puma (6.2.2)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
raabro (1.4.0)
|
raabro (1.4.0)
|
||||||
racc (1.6.2)
|
racc (1.6.2)
|
||||||
@@ -556,9 +556,9 @@ GEM
|
|||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
redcarpet (3.6.0)
|
redcarpet (3.6.0)
|
||||||
redis (4.8.1)
|
redis (4.8.1)
|
||||||
redis-client (0.14.0)
|
redis-client (0.14.1)
|
||||||
connection_pool
|
connection_pool
|
||||||
regexp_parser (2.7.0)
|
regexp_parser (2.8.0)
|
||||||
reline (0.3.3)
|
reline (0.3.3)
|
||||||
io-console (~> 0.5)
|
io-console (~> 0.5)
|
||||||
request_store (1.5.1)
|
request_store (1.5.1)
|
||||||
@@ -612,7 +612,7 @@ GEM
|
|||||||
rswag-ui (2.8.0)
|
rswag-ui (2.8.0)
|
||||||
actionpack (>= 3.1, < 7.1)
|
actionpack (>= 3.1, < 7.1)
|
||||||
railties (>= 3.1, < 7.1)
|
railties (>= 3.1, < 7.1)
|
||||||
rubocop (1.49.0)
|
rubocop (1.50.2)
|
||||||
json (~> 2.3)
|
json (~> 2.3)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 3.2.0.0)
|
parser (>= 3.2.0.0)
|
||||||
@@ -624,7 +624,7 @@ GEM
|
|||||||
unicode-display_width (>= 2.4.0, < 3.0)
|
unicode-display_width (>= 2.4.0, < 3.0)
|
||||||
rubocop-ast (1.28.0)
|
rubocop-ast (1.28.0)
|
||||||
parser (>= 3.2.1.0)
|
parser (>= 3.2.1.0)
|
||||||
rubocop-rails (2.18.0)
|
rubocop-rails (2.19.1)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
rack (>= 1.1)
|
rack (>= 1.1)
|
||||||
rubocop (>= 1.33.0, < 2.0)
|
rubocop (>= 1.33.0, < 2.0)
|
||||||
@@ -652,7 +652,7 @@ GEM
|
|||||||
semantic_range (3.0.0)
|
semantic_range (3.0.0)
|
||||||
shoulda-matchers (5.3.0)
|
shoulda-matchers (5.3.0)
|
||||||
activesupport (>= 5.2.0)
|
activesupport (>= 5.2.0)
|
||||||
sidekiq (7.0.7)
|
sidekiq (7.0.8)
|
||||||
concurrent-ruby (< 2)
|
concurrent-ruby (< 2)
|
||||||
connection_pool (>= 2.3.0)
|
connection_pool (>= 2.3.0)
|
||||||
rack (>= 2.2.4)
|
rack (>= 2.2.4)
|
||||||
@@ -698,7 +698,7 @@ GEM
|
|||||||
railties (>= 5.2, < 8)
|
railties (>= 5.2, < 8)
|
||||||
redis (>= 4.0, < 6.0)
|
redis (>= 4.0, < 6.0)
|
||||||
stringex (2.8.5)
|
stringex (2.8.5)
|
||||||
stripe (8.3.0)
|
stripe (8.5.0)
|
||||||
swd (1.3.0)
|
swd (1.3.0)
|
||||||
activesupport (>= 3)
|
activesupport (>= 3)
|
||||||
attr_required (>= 0.0.5)
|
attr_required (>= 0.0.5)
|
||||||
|
|||||||
4
Procfile
4
Procfile
@@ -1,5 +1,5 @@
|
|||||||
# Foreman Procfile. Start all dev server processes with: `foreman start`
|
# Foreman Procfile. Start all dev server processes with: `foreman start`
|
||||||
|
|
||||||
rails: bundle exec rails s -p 3000
|
rails: DEV_CACHING=true bundle exec rails s -p 3000
|
||||||
webpack: ./bin/webpack-dev-server
|
webpack: ./bin/webpack-dev-server
|
||||||
sidekiq: bundle exec sidekiq -q mailers -q default
|
sidekiq: DEV_CACHING=true bundle exec sidekiq -q mailers -q default
|
||||||
|
|||||||
@@ -11,5 +11,6 @@ angular.module("admin.indexUtils").factory 'SortOptions', ->
|
|||||||
sortingExpr
|
sortingExpr
|
||||||
|
|
||||||
toggle: (predicate) ->
|
toggle: (predicate) ->
|
||||||
@reverse = (@predicate == predicate) && !@reverse
|
# predicate is a string or an array of strings
|
||||||
|
@reverse = (JSON.stringify(@predicate) == JSON.stringify(predicate)) && !@reverse
|
||||||
@predicate = predicate
|
@predicate = predicate
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
|||||||
]
|
]
|
||||||
$scope.page = 1
|
$scope.page = 1
|
||||||
$scope.per_page = $scope.per_page_options[0].id
|
$scope.per_page = $scope.per_page_options[0].id
|
||||||
|
$scope.filterByVariantId = null
|
||||||
searchThrough = ["order_distributor_name",
|
searchThrough = ["order_distributor_name",
|
||||||
"order_bill_address_phone",
|
"order_bill_address_phone",
|
||||||
"order_bill_address_firstname",
|
"order_bill_address_firstname",
|
||||||
@@ -68,6 +69,7 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
|||||||
|
|
||||||
RequestMonitor.load LineItems.index(
|
RequestMonitor.load LineItems.index(
|
||||||
"q[#{searchThrough}]": $scope.query,
|
"q[#{searchThrough}]": $scope.query,
|
||||||
|
"q[variant_id_eq]": $scope.filterByVariantId if $scope.filterByVariantId,
|
||||||
"q[order_state_not_eq]": "canceled",
|
"q[order_state_not_eq]": "canceled",
|
||||||
"q[order_shipment_state_not_eq]": "shipped",
|
"q[order_shipment_state_not_eq]": "shipped",
|
||||||
"q[order_completed_at_not_null]": "true",
|
"q[order_completed_at_not_null]": "true",
|
||||||
@@ -176,6 +178,17 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
|
|||||||
$scope.setSelectedUnitsVariant = (unitsProduct,unitsVariant) ->
|
$scope.setSelectedUnitsVariant = (unitsProduct,unitsVariant) ->
|
||||||
$scope.selectedUnitsProduct = unitsProduct
|
$scope.selectedUnitsProduct = unitsProduct
|
||||||
$scope.selectedUnitsVariant = unitsVariant
|
$scope.selectedUnitsVariant = unitsVariant
|
||||||
|
$scope.filterByVariantId = unitsVariant.id
|
||||||
|
$scope.page = 1
|
||||||
|
$scope.refreshData()
|
||||||
|
|
||||||
|
$scope.resetSelectedUnitsVariant = ->
|
||||||
|
$scope.selectedUnitsProduct = { }
|
||||||
|
$scope.selectedUnitsVariant = { }
|
||||||
|
$scope.filterByVariantId = null
|
||||||
|
$scope.sharedResource = false
|
||||||
|
$scope.page = 1
|
||||||
|
$scope.refreshData()
|
||||||
|
|
||||||
$scope.getLineItemScale = (lineItem) ->
|
$scope.getLineItemScale = (lineItem) ->
|
||||||
if lineItem.units_product && lineItem.units_variant && (lineItem.units_product.variant_unit == "weight" || lineItem.units_product.variant_unit == "volume")
|
if lineItem.units_product && lineItem.units_variant && (lineItem.units_product.variant_unit == "weight" || lineItem.units_product.variant_unit == "volume")
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
angular.module("admin.lineItems").filter "variantFilter", ->
|
|
||||||
return (lineItems,selectedUnitsProduct,selectedUnitsVariant,sharedResource) ->
|
|
||||||
filtered = []
|
|
||||||
filtered.push lineItem for lineItem in lineItems when (angular.equals(selectedUnitsProduct,{}) ||
|
|
||||||
(lineItem.units_product.id == selectedUnitsProduct.id && (sharedResource || lineItem.units_variant.id == selectedUnitsVariant.id ) ) )
|
|
||||||
filtered
|
|
||||||
@@ -4,7 +4,8 @@ $(document).ready(function() {
|
|||||||
|
|
||||||
initAlert()
|
initAlert()
|
||||||
initConfirm()
|
initConfirm()
|
||||||
initCancelOrder()
|
initButtonCancel()
|
||||||
|
initLinkCancel()
|
||||||
|
|
||||||
if ($('#variant_autocomplete_template').length > 0) {
|
if ($('#variant_autocomplete_template').length > 0) {
|
||||||
window.variantTemplate = Handlebars.compile($('#variant_autocomplete_template').text());
|
window.variantTemplate = Handlebars.compile($('#variant_autocomplete_template').text());
|
||||||
@@ -276,17 +277,23 @@ ofnConfirm = function(callback) {
|
|||||||
$('#custom-confirm').show();
|
$('#custom-confirm').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
initCancelOrder = function() {
|
initCancelAction = function(e){
|
||||||
$('#cancel_order_form').submit(function(e){
|
ofnCancelOrderAlert((confirm, sendEmailCancellation, restock_items) => {
|
||||||
ofnCancelOrderAlert((confirm, sendEmailCancellation, restock_items) => {
|
if (confirm) {
|
||||||
if (confirm) {
|
var redirectTo = new URL(Spree.routes.cancel_order.toString());
|
||||||
var redirectTo = new URL(Spree.routes.cancel_order.toString());
|
redirectTo.searchParams.append("send_cancellation_email", sendEmailCancellation);
|
||||||
redirectTo.searchParams.append("send_cancellation_email", sendEmailCancellation);
|
redirectTo.searchParams.append("restock_items", restock_items);
|
||||||
redirectTo.searchParams.append("restock_items", restock_items);
|
window.location.href = redirectTo.toString();
|
||||||
window.location.href = redirectTo.toString();
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
e.preventDefault();
|
|
||||||
return false;
|
|
||||||
});
|
});
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
initButtonCancel = function() {
|
||||||
|
$('#cancel_order_form').submit(initCancelAction)
|
||||||
|
}
|
||||||
|
|
||||||
|
initLinkCancel = function() {
|
||||||
|
$('#links-dropdown a[href$="cancel"]').click(initCancelAction);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ angular.module('Darkswarm').factory "EnterpriseModal", ($modal, $rootScope, $htt
|
|||||||
# Build a modal popup for an enterprise.
|
# Build a modal popup for an enterprise.
|
||||||
new class EnterpriseModal
|
new class EnterpriseModal
|
||||||
open: (enterprise)->
|
open: (enterprise)->
|
||||||
|
return if enterprise.visible == 'hidden'
|
||||||
scope = $rootScope.$new(true) # Spawn an isolate to contain the enterprise
|
scope = $rootScope.$new(true) # Spawn an isolate to contain the enterprise
|
||||||
scope.embedded_layout = window.location.search.indexOf("embedded_shopfront=true") != -1
|
scope.embedded_layout = window.location.search.indexOf("embedded_shopfront=true") != -1
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
require 'open_food_network/address_finder'
|
require 'open_food_network/address_finder'
|
||||||
|
|
||||||
|
# rubocop:disable Metrics/ClassLength
|
||||||
module Admin
|
module Admin
|
||||||
class CustomersController < Admin::ResourceController
|
class CustomersController < Admin::ResourceController
|
||||||
before_action :load_managed_shops, only: :index, if: :html_request?
|
before_action :load_managed_shops, only: :index, if: :html_request?
|
||||||
@@ -67,7 +68,7 @@ module Admin
|
|||||||
|
|
||||||
def collection
|
def collection
|
||||||
if json_request? && params[:enterprise_id].present?
|
if json_request? && params[:enterprise_id].present?
|
||||||
CustomersWithBalance.new(Customer.of(managed_enterprise_id)).query.
|
CustomersWithBalance.new(customers).query.
|
||||||
includes(
|
includes(
|
||||||
:enterprise,
|
:enterprise,
|
||||||
{ bill_address: [:state, :country] },
|
{ bill_address: [:state, :country] },
|
||||||
@@ -79,6 +80,15 @@ module Admin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def customers
|
||||||
|
return @customers if @customers.present?
|
||||||
|
|
||||||
|
@customers = Customer.managed_by(spree_current_user)
|
||||||
|
return @customers if params[:enterprise_id].blank?
|
||||||
|
|
||||||
|
@customers = @customers.where(enterprise_id: params[:enterprise_id])
|
||||||
|
end
|
||||||
|
|
||||||
def managed_enterprise_id
|
def managed_enterprise_id
|
||||||
@managed_enterprise_id ||= Enterprise.managed_by(spree_current_user).
|
@managed_enterprise_id ||= Enterprise.managed_by(spree_current_user).
|
||||||
select('enterprises.id').find_by(id: params[:enterprise_id])
|
select('enterprises.id').find_by(id: params[:enterprise_id])
|
||||||
@@ -120,3 +130,4 @@ module Admin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# rubocop:enable Metrics/ClassLength
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
module Admin
|
module Admin
|
||||||
class ReportsController < Spree::Admin::BaseController
|
class ReportsController < Spree::Admin::BaseController
|
||||||
|
include ActiveStorage::SetCurrent
|
||||||
include ReportsActions
|
include ReportsActions
|
||||||
helper ReportsHelper
|
helper ReportsHelper
|
||||||
|
|
||||||
@@ -21,11 +22,13 @@ module Admin
|
|||||||
def show
|
def show
|
||||||
@report = report_class.new(spree_current_user, params, render: render_data?)
|
@report = report_class.new(spree_current_user, params, render: render_data?)
|
||||||
|
|
||||||
if report_format.present?
|
if params[:report_format].present?
|
||||||
export_report
|
export_report
|
||||||
else
|
else
|
||||||
show_report
|
show_report
|
||||||
end
|
end
|
||||||
|
rescue Timeout::Error
|
||||||
|
render_timeout_error
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -36,6 +39,7 @@ module Admin
|
|||||||
|
|
||||||
def show_report
|
def show_report
|
||||||
assign_view_data
|
assign_view_data
|
||||||
|
@table = render_report_as(:html) if render_data?
|
||||||
render "show"
|
render "show"
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -45,7 +49,6 @@ module Admin
|
|||||||
@report_subtype = report_subtype
|
@report_subtype = report_subtype
|
||||||
@report_title = report_title
|
@report_title = report_title
|
||||||
@rendering_options = rendering_options
|
@rendering_options = rendering_options
|
||||||
@table = render_report_as(:html) if render_data?
|
|
||||||
@data = Reporting::FrontendData.new(spree_current_user)
|
@data = Reporting::FrontendData.new(spree_current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -55,16 +58,43 @@ module Admin
|
|||||||
|
|
||||||
def render_report_as(format)
|
def render_report_as(format)
|
||||||
if OpenFoodNetwork::FeatureToggle.enabled?(:background_reports, spree_current_user)
|
if OpenFoodNetwork::FeatureToggle.enabled?(:background_reports, spree_current_user)
|
||||||
job = ReportJob.perform_later(
|
@blob = ReportBlob.create_for_upload_later!(report_filename)
|
||||||
report_class, spree_current_user, params, format
|
ReportJob.perform_later(
|
||||||
|
report_class, spree_current_user, params, format, @blob
|
||||||
)
|
)
|
||||||
sleep 1 until job.done?
|
Timeout.timeout(max_wait_time) do
|
||||||
|
sleep 1 until @blob.content_stored?
|
||||||
|
end
|
||||||
|
|
||||||
# This result has been rendered by Rails in safe mode already.
|
# This result has been rendered by Rails in safe mode already.
|
||||||
job.result.html_safe # rubocop:disable Rails/OutputSafety
|
@blob.result.html_safe # rubocop:disable Rails/OutputSafety
|
||||||
else
|
else
|
||||||
@report.render_as(format)
|
@report.render_as(format)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def render_timeout_error
|
||||||
|
assign_view_data
|
||||||
|
if @blob
|
||||||
|
@error = ".report_taking_longer_html"
|
||||||
|
@error_url = @blob.url
|
||||||
|
else
|
||||||
|
@error = ".report_taking_longer"
|
||||||
|
@error_url = ""
|
||||||
|
end
|
||||||
|
render "show"
|
||||||
|
end
|
||||||
|
|
||||||
|
def max_wait_time
|
||||||
|
# This value is used by rack-timeout and nginx, usually 30 seconds in
|
||||||
|
# staging and production:
|
||||||
|
server_timeout = ENV.fetch("RACK_TIMEOUT_SERVICE_TIMEOUT", "15").to_f
|
||||||
|
|
||||||
|
# Zero disables the timeout:
|
||||||
|
return 0 if server_timeout.zero?
|
||||||
|
|
||||||
|
# We want to time out earlier than nginx:
|
||||||
|
server_timeout - 2.seconds
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ module Admin
|
|||||||
|
|
||||||
options = [{ id: '0', name: 'All' }]
|
options = [{ id: '0', name: 'All' }]
|
||||||
import_dates.collect(&:import_date).map { |i|
|
import_dates.collect(&:import_date).map { |i|
|
||||||
options.push(id: i.to_date, name: i.to_date.to_formatted_s(:long))
|
options.push(id: i.to_date, name: i.to_date.to_fs(:long))
|
||||||
}
|
}
|
||||||
|
|
||||||
options
|
options
|
||||||
|
|||||||
@@ -80,9 +80,7 @@ module Api
|
|||||||
end
|
end
|
||||||
|
|
||||||
def visible_customers
|
def visible_customers
|
||||||
current_api_user.customers.or(
|
Customer.managed_by(current_api_user)
|
||||||
Customer.where(enterprise_id: editable_enterprises)
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def customer_params
|
def customer_params
|
||||||
@@ -106,10 +104,6 @@ module Api
|
|||||||
attributes
|
attributes
|
||||||
end
|
end
|
||||||
|
|
||||||
def editable_enterprises
|
|
||||||
OpenFoodNetwork::Permissions.new(current_api_user).editable_enterprises.select(:id)
|
|
||||||
end
|
|
||||||
|
|
||||||
def include_options
|
def include_options
|
||||||
fields = [params.fetch(:include, [])].flatten
|
fields = [params.fetch(:include, [])].flatten
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ module ReportsActions
|
|||||||
end
|
end
|
||||||
|
|
||||||
def report_format
|
def report_format
|
||||||
params[:report_format]
|
params[:report_format].presence || "html"
|
||||||
end
|
end
|
||||||
|
|
||||||
def report_filename
|
def report_filename
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ module Spree
|
|||||||
def product_import_dates
|
def product_import_dates
|
||||||
options = [{ id: '0', name: '' }]
|
options = [{ id: '0', name: '' }]
|
||||||
product_import_dates_query.collect(&:import_date).
|
product_import_dates_query.collect(&:import_date).
|
||||||
map { |i| options.push(id: i.to_date, name: i.to_date.to_formatted_s(:long)) }
|
map { |i| options.push(id: i.to_date, name: i.to_date.to_fs(:long)) }
|
||||||
|
|
||||||
options
|
options
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ module Admin
|
|||||||
producers.size == 1 ? producers.first.id : nil
|
producers.size == 1 ? producers.first.id : nil
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Metrics/MethodLength
|
|
||||||
def enterprise_side_menu_items(enterprise)
|
def enterprise_side_menu_items(enterprise)
|
||||||
is_shop = enterprise.sells != "none"
|
is_shop = enterprise.sells != "none"
|
||||||
show_properties = !!enterprise.is_primary_producer
|
show_properties = !!enterprise.is_primary_producer
|
||||||
@@ -58,6 +57,5 @@ module Admin
|
|||||||
|
|
||||||
{ name: 'white_label', icon_class: "icon-leaf", show: true }
|
{ name: 'white_label', icon_class: "icon-leaf", show: true }
|
||||||
end
|
end
|
||||||
# rubocop:enable Metrics/MethodLength
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
module ReportsHelper
|
module ReportsHelper
|
||||||
def report_order_cycle_options(order_cycles)
|
def report_order_cycle_options(order_cycles)
|
||||||
order_cycles.map do |oc|
|
order_cycles.map do |oc|
|
||||||
orders_open_at = oc.orders_open_at&.to_s(:short) || 'NA'
|
orders_open_at = oc.orders_open_at&.to_fs(:short) || 'NA'
|
||||||
orders_close_at = oc.orders_close_at&.to_s(:short) || 'NA'
|
orders_close_at = oc.orders_close_at&.to_fs(:short) || 'NA'
|
||||||
["#{oc.name} (#{orders_open_at} - #{orders_close_at})".html_safe, oc.id]
|
["#{oc.name} (#{orders_open_at} - #{orders_close_at})".html_safe, oc.id]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -105,8 +105,7 @@ module Spree
|
|||||||
def cancel_order_link
|
def cancel_order_link
|
||||||
{ name: t(:cancel_order),
|
{ name: t(:cancel_order),
|
||||||
url: spree.fire_admin_order_path(@order.number, e: 'cancel'),
|
url: spree.fire_admin_order_path(@order.number, e: 'cancel'),
|
||||||
icon: 'icon-trash',
|
icon: 'icon-trash' }
|
||||||
confirm: t(:are_you_sure) }
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def cancel_event_link
|
def cancel_event_link
|
||||||
|
|||||||
@@ -1,34 +1,10 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Renders a report and saves it to a temporary file.
|
# Renders a report and stores it in a given blob.
|
||||||
class ReportJob < ActiveJob::Base
|
class ReportJob < ApplicationJob
|
||||||
def perform(report_class, user, params, format)
|
def perform(report_class, user, params, format, blob)
|
||||||
report = report_class.new(user, params, render: true)
|
report = report_class.new(user, params, render: true)
|
||||||
result = report.render_as(format)
|
result = report.render_as(format)
|
||||||
write(result)
|
blob.store(result)
|
||||||
end
|
|
||||||
|
|
||||||
def done?
|
|
||||||
@done ||= File.file?(filename)
|
|
||||||
end
|
|
||||||
|
|
||||||
def result
|
|
||||||
@result ||= read_result
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def write(result)
|
|
||||||
File.write(filename, result, mode: "wb")
|
|
||||||
end
|
|
||||||
|
|
||||||
def read_result
|
|
||||||
File.read(filename)
|
|
||||||
ensure
|
|
||||||
File.unlink(filename)
|
|
||||||
end
|
|
||||||
|
|
||||||
def filename
|
|
||||||
Rails.root.join("tmp/report-#{job_id}")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class JsonApiSchema
|
|||||||
end
|
end
|
||||||
|
|
||||||
def relationship_properties
|
def relationship_properties
|
||||||
relationships.to_h { |name| [name, relationship_schema(name)] }
|
relationships.index_with { |name| relationship_schema(name) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Example
|
# Example
|
||||||
|
|||||||
23
app/mailers/application_mailer.rb
Normal file
23
app/mailers/application_mailer.rb
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class ApplicationMailer < ActionMailer::Base
|
||||||
|
# Inline stylesheets
|
||||||
|
include Roadie::Rails::Automatic
|
||||||
|
|
||||||
|
helper TermsAndConditionsHelper
|
||||||
|
|
||||||
|
default from: -> { Spree::Config[:mails_from] }
|
||||||
|
layout 'mailer'
|
||||||
|
|
||||||
|
def money(amount)
|
||||||
|
Spree::Money.new(amount).to_s
|
||||||
|
end
|
||||||
|
helper_method :money
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def roadie_options
|
||||||
|
# This lets us specify assets using relative paths in email templates
|
||||||
|
super.merge(url_options: { host: URI(main_app.root_url).host })
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'devise/mailers/helpers'
|
require 'devise/mailers/helpers'
|
||||||
class EnterpriseMailer < Spree::BaseMailer
|
class EnterpriseMailer < ApplicationMailer
|
||||||
include Devise::Mailers::Helpers
|
include Devise::Mailers::Helpers
|
||||||
include I18nHelper
|
include I18nHelper
|
||||||
|
|
||||||
@@ -12,7 +12,6 @@ class EnterpriseMailer < Spree::BaseMailer
|
|||||||
enterprise: @enterprise.name,
|
enterprise: @enterprise.name,
|
||||||
sitename: Spree::Config[:site_name])
|
sitename: Spree::Config[:site_name])
|
||||||
mail(to: enterprise.contact.email,
|
mail(to: enterprise.contact.email,
|
||||||
from: from_address,
|
|
||||||
subject: subject)
|
subject: subject)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -20,12 +19,10 @@ class EnterpriseMailer < Spree::BaseMailer
|
|||||||
def manager_invitation(enterprise, user)
|
def manager_invitation(enterprise, user)
|
||||||
@enterprise = enterprise
|
@enterprise = enterprise
|
||||||
@instance = Spree::Config[:site_name]
|
@instance = Spree::Config[:site_name]
|
||||||
@instance_email = from_address
|
|
||||||
|
|
||||||
I18n.with_locale valid_locale(@enterprise.owner) do
|
I18n.with_locale valid_locale(@enterprise.owner) do
|
||||||
subject = t('enterprise_mailer.invite_manager.subject', enterprise: @enterprise.name)
|
subject = t('enterprise_mailer.invite_manager.subject', enterprise: @enterprise.name)
|
||||||
mail(to: user.email,
|
mail(to: user.email,
|
||||||
from: from_address,
|
|
||||||
subject: subject)
|
subject: subject)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class PaymentMailer < Spree::BaseMailer
|
class PaymentMailer < ApplicationMailer
|
||||||
include I18nHelper
|
include I18nHelper
|
||||||
|
|
||||||
def authorize_payment(payment)
|
def authorize_payment(payment)
|
||||||
@@ -8,7 +8,7 @@ class PaymentMailer < Spree::BaseMailer
|
|||||||
subject = I18n.t('spree.payment_mailer.authorize_payment.subject',
|
subject = I18n.t('spree.payment_mailer.authorize_payment.subject',
|
||||||
distributor: @payment.order.distributor.name)
|
distributor: @payment.order.distributor.name)
|
||||||
I18n.with_locale valid_locale(@payment.order.user) do
|
I18n.with_locale valid_locale(@payment.order.user) do
|
||||||
mail(to: payment.order.email, from: from_address, subject: subject)
|
mail(to: payment.order.email, subject: subject)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -19,7 +19,6 @@ class PaymentMailer < Spree::BaseMailer
|
|||||||
order: @payment.order)
|
order: @payment.order)
|
||||||
I18n.with_locale valid_locale(shop_owner) do
|
I18n.with_locale valid_locale(shop_owner) do
|
||||||
mail(to: shop_owner.email,
|
mail(to: shop_owner.email,
|
||||||
from: from_address,
|
|
||||||
subject: subject)
|
subject: subject)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ProducerMailer < Spree::BaseMailer
|
class ProducerMailer < ApplicationMailer
|
||||||
include I18nHelper
|
include I18nHelper
|
||||||
|
|
||||||
def order_cycle_report(producer, order_cycle)
|
def order_cycle_report(producer, order_cycle)
|
||||||
@@ -14,7 +14,6 @@ class ProducerMailer < Spree::BaseMailer
|
|||||||
|
|
||||||
mail(
|
mail(
|
||||||
to: @producer.contact.email,
|
to: @producer.contact.email,
|
||||||
from: from_address,
|
|
||||||
subject: subject,
|
subject: subject,
|
||||||
reply_to: @coordinator.contact.email,
|
reply_to: @coordinator.contact.email,
|
||||||
cc: @coordinator.contact.email
|
cc: @coordinator.contact.email
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module Spree
|
|
||||||
class BaseMailer < ActionMailer::Base
|
|
||||||
# Inline stylesheets
|
|
||||||
include Roadie::Rails::Automatic
|
|
||||||
|
|
||||||
helper TermsAndConditionsHelper
|
|
||||||
|
|
||||||
layout 'mailer'
|
|
||||||
|
|
||||||
def from_address
|
|
||||||
Spree::Config[:mails_from]
|
|
||||||
end
|
|
||||||
|
|
||||||
def money(amount)
|
|
||||||
Spree::Money.new(amount).to_s
|
|
||||||
end
|
|
||||||
helper_method :money
|
|
||||||
|
|
||||||
protected
|
|
||||||
|
|
||||||
def roadie_options
|
|
||||||
# This lets us specify assets using relative paths in email templates
|
|
||||||
super.merge(url_options: { host: URI(main_app.root_url).host })
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Spree
|
module Spree
|
||||||
class OrderMailer < BaseMailer
|
class OrderMailer < ApplicationMailer
|
||||||
helper 'checkout'
|
helper 'checkout'
|
||||||
helper SpreeCurrencyHelper
|
helper SpreeCurrencyHelper
|
||||||
helper Spree::PaymentMethodsHelper
|
helper Spree::PaymentMethodsHelper
|
||||||
@@ -13,7 +13,6 @@ module Spree
|
|||||||
@order = find_order(order_or_order_id)
|
@order = find_order(order_or_order_id)
|
||||||
I18n.with_locale valid_locale(@order.user) do
|
I18n.with_locale valid_locale(@order.user) do
|
||||||
mail(to: @order.email,
|
mail(to: @order.email,
|
||||||
from: from_address,
|
|
||||||
subject: mail_subject(t('spree.order_mailer.cancel_email.subject'), resend))
|
subject: mail_subject(t('spree.order_mailer.cancel_email.subject'), resend))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -23,7 +22,6 @@ module Spree
|
|||||||
I18n.with_locale valid_locale(@order.distributor.owner) do
|
I18n.with_locale valid_locale(@order.distributor.owner) do
|
||||||
subject = I18n.t('spree.order_mailer.cancel_email_for_shop.subject')
|
subject = I18n.t('spree.order_mailer.cancel_email_for_shop.subject')
|
||||||
mail(to: @order.distributor.contact.email,
|
mail(to: @order.distributor.contact.email,
|
||||||
from: from_address,
|
|
||||||
subject: subject)
|
subject: subject)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -33,7 +31,6 @@ module Spree
|
|||||||
I18n.with_locale valid_locale(@order.user) do
|
I18n.with_locale valid_locale(@order.user) do
|
||||||
subject = mail_subject(t('spree.order_mailer.confirm_email.subject'), resend)
|
subject = mail_subject(t('spree.order_mailer.confirm_email.subject'), resend)
|
||||||
mail(to: @order.email,
|
mail(to: @order.email,
|
||||||
from: from_address,
|
|
||||||
subject: subject,
|
subject: subject,
|
||||||
reply_to: @order.distributor.contact.email)
|
reply_to: @order.distributor.contact.email)
|
||||||
end
|
end
|
||||||
@@ -44,7 +41,6 @@ module Spree
|
|||||||
I18n.with_locale valid_locale(@order.user) do
|
I18n.with_locale valid_locale(@order.user) do
|
||||||
subject = mail_subject(t('spree.order_mailer.confirm_email.subject'), resend)
|
subject = mail_subject(t('spree.order_mailer.confirm_email.subject'), resend)
|
||||||
mail(to: @order.distributor.contact.email,
|
mail(to: @order.distributor.contact.email,
|
||||||
from: from_address,
|
|
||||||
subject: subject)
|
subject: subject)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -56,7 +52,6 @@ module Spree
|
|||||||
attach_file("invoice-#{@order.number}.pdf", pdf)
|
attach_file("invoice-#{@order.number}.pdf", pdf)
|
||||||
I18n.with_locale valid_locale(@order.user) do
|
I18n.with_locale valid_locale(@order.user) do
|
||||||
mail(to: @order.email,
|
mail(to: @order.email,
|
||||||
from: from_address,
|
|
||||||
subject: mail_subject(t(:invoice), false),
|
subject: mail_subject(t(:invoice), false),
|
||||||
reply_to: @order.distributor.contact.email)
|
reply_to: @order.distributor.contact.email)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Spree
|
module Spree
|
||||||
class ShipmentMailer < BaseMailer
|
class ShipmentMailer < ApplicationMailer
|
||||||
def shipped_email(shipment, delivery:)
|
def shipped_email(shipment, delivery:)
|
||||||
@shipment = shipment.respond_to?(:id) ? shipment : Spree::Shipment.find(shipment)
|
@shipment = shipment.respond_to?(:id) ? shipment : Spree::Shipment.find(shipment)
|
||||||
@delivery = delivery
|
@delivery = delivery
|
||||||
subject = base_subject
|
subject = base_subject
|
||||||
mail(to: @shipment.order.email, from: from_address, subject: subject)
|
mail(to: @shipment.order.email, subject: subject)
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Spree
|
module Spree
|
||||||
class TestMailer < BaseMailer
|
class TestMailer < ApplicationMailer
|
||||||
def test_email(user)
|
def test_email(user)
|
||||||
recipient = user.respond_to?(:id) ? user : Spree::User.find(user)
|
recipient = user.respond_to?(:id) ? user : Spree::User.find(user)
|
||||||
subject = "#{Spree::Config[:site_name]} #{t('spree.test_mailer.test_email.subject')}"
|
subject = "#{Spree::Config[:site_name]} #{t('spree.test_mailer.test_email.subject')}"
|
||||||
mail(to: recipient.email, from: from_address, subject: subject)
|
mail(to: recipient.email, subject: subject)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# This mailer is configured to be the Devise mailer
|
# This mailer is configured to be the Devise mailer
|
||||||
# Some methods here override Devise::Mailer methods
|
# Some methods here override Devise::Mailer methods
|
||||||
module Spree
|
module Spree
|
||||||
class UserMailer < BaseMailer
|
class UserMailer < ApplicationMailer
|
||||||
include I18nHelper
|
include I18nHelper
|
||||||
|
|
||||||
helper MailerHelper
|
helper MailerHelper
|
||||||
@@ -16,7 +16,7 @@ module Spree
|
|||||||
"#{I18n.t('spree.user_mailer.reset_password_instructions.subject')}"
|
"#{I18n.t('spree.user_mailer.reset_password_instructions.subject')}"
|
||||||
|
|
||||||
I18n.with_locale valid_locale(user) do
|
I18n.with_locale valid_locale(user) do
|
||||||
mail(to: user.email, from: from_address, subject: subject)
|
mail(to: user.email, subject: subject)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ module Spree
|
|||||||
def signup_confirmation(user)
|
def signup_confirmation(user)
|
||||||
@user = user
|
@user = user
|
||||||
I18n.with_locale valid_locale(@user) do
|
I18n.with_locale valid_locale(@user) do
|
||||||
mail(to: user.email, from: from_address,
|
mail(to: user.email,
|
||||||
subject: t(:welcome_to) + ' ' + Spree::Config[:site_name])
|
subject: t(:welcome_to) + ' ' + Spree::Config[:site_name])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -39,7 +39,6 @@ module Spree
|
|||||||
I18n.with_locale valid_locale(@user) do
|
I18n.with_locale valid_locale(@user) do
|
||||||
subject = t('spree.user_mailer.confirmation_instructions.subject')
|
subject = t('spree.user_mailer.confirmation_instructions.subject')
|
||||||
mail(to: confirmation_email_address,
|
mail(to: confirmation_email_address,
|
||||||
from: from_address,
|
|
||||||
subject: subject)
|
subject: subject)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class SubscriptionMailer < Spree::BaseMailer
|
class SubscriptionMailer < ApplicationMailer
|
||||||
helper 'checkout'
|
helper 'checkout'
|
||||||
helper MailerHelper
|
helper MailerHelper
|
||||||
helper ShopMailHelper
|
helper ShopMailHelper
|
||||||
@@ -37,7 +37,6 @@ class SubscriptionMailer < Spree::BaseMailer
|
|||||||
@shop = Enterprise.find(summary.shop_id)
|
@shop = Enterprise.find(summary.shop_id)
|
||||||
@summary = summary
|
@summary = summary
|
||||||
mail(to: @shop.contact.email,
|
mail(to: @shop.contact.email,
|
||||||
from: from_address,
|
|
||||||
subject: "#{Spree::Config[:site_name]} #{t('subscription_mailer.placement_summary_email.subject')}")
|
subject: "#{Spree::Config[:site_name]} #{t('subscription_mailer.placement_summary_email.subject')}")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -45,7 +44,6 @@ class SubscriptionMailer < Spree::BaseMailer
|
|||||||
@shop = Enterprise.find(summary.shop_id)
|
@shop = Enterprise.find(summary.shop_id)
|
||||||
@summary = summary
|
@summary = summary
|
||||||
mail(to: @shop.contact.email,
|
mail(to: @shop.contact.email,
|
||||||
from: from_address,
|
|
||||||
subject: "#{Spree::Config[:site_name]} #{t('subscription_mailer.confirmation_summary_email.subject')}")
|
subject: "#{Spree::Config[:site_name]} #{t('subscription_mailer.confirmation_summary_email.subject')}")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -56,7 +54,6 @@ class SubscriptionMailer < Spree::BaseMailer
|
|||||||
confirm_email_subject = t('spree.order_mailer.confirm_email.subject')
|
confirm_email_subject = t('spree.order_mailer.confirm_email.subject')
|
||||||
subject = "#{Spree::Config[:site_name]} #{confirm_email_subject} ##{order.number}"
|
subject = "#{Spree::Config[:site_name]} #{confirm_email_subject} ##{order.number}"
|
||||||
mail(to: order.email,
|
mail(to: order.email,
|
||||||
from: from_address,
|
|
||||||
subject: subject,
|
subject: subject,
|
||||||
reply_to: order.distributor.contact.email)
|
reply_to: order.distributor.contact.email)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,4 +4,8 @@ module AddressDisplay
|
|||||||
def full_name_reverse
|
def full_name_reverse
|
||||||
[lastname, firstname].reject(&:blank?).join(" ")
|
[lastname, firstname].reject(&:blank?).join(" ")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def full_name_for_sorting
|
||||||
|
[last_name, first_name].reject(&:blank?).join(", ")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class Customer < ApplicationRecord
|
|||||||
uniqueness: { scope: :enterprise_id, message: I18n.t('validation_msg_is_associated_with_an_exising_customer') }
|
uniqueness: { scope: :enterprise_id, message: I18n.t('validation_msg_is_associated_with_an_exising_customer') }
|
||||||
|
|
||||||
scope :of, ->(enterprise) { where(enterprise_id: enterprise) }
|
scope :of, ->(enterprise) { where(enterprise_id: enterprise) }
|
||||||
|
scope :managed_by, ->(user) { user&.persisted? ? where(user: user).or(of(Enterprise.managed_by(user))) : none }
|
||||||
|
|
||||||
before_create :associate_user
|
before_create :associate_user
|
||||||
|
|
||||||
|
|||||||
@@ -85,8 +85,12 @@ class Enterprise < ApplicationRecord
|
|||||||
has_one_attached :promo_image
|
has_one_attached :promo_image
|
||||||
has_one_attached :terms_and_conditions
|
has_one_attached :terms_and_conditions
|
||||||
|
|
||||||
validates :logo, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
validates :logo,
|
||||||
validates :promo_image, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
processable_image: true,
|
||||||
|
content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
||||||
|
validates :promo_image,
|
||||||
|
processable_image: true,
|
||||||
|
content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
||||||
validates :terms_and_conditions, content_type: {
|
validates :terms_and_conditions, content_type: {
|
||||||
in: "application/pdf",
|
in: "application/pdf",
|
||||||
message: I18n.t(:enterprise_terms_and_conditions_type_error),
|
message: I18n.t(:enterprise_terms_and_conditions_type_error),
|
||||||
@@ -267,8 +271,7 @@ class Enterprise < ApplicationRecord
|
|||||||
|
|
||||||
def plus_parents_and_order_cycle_producers(order_cycles)
|
def plus_parents_and_order_cycle_producers(order_cycles)
|
||||||
oc_producer_ids = Exchange.in_order_cycle(order_cycles).incoming.pluck :sender_id
|
oc_producer_ids = Exchange.in_order_cycle(order_cycles).incoming.pluck :sender_id
|
||||||
Enterprise.not_hidden.is_primary_producer
|
Enterprise.is_primary_producer.parents_of_one_union_others(id, oc_producer_ids | [id])
|
||||||
.parents_of_one_union_others(id, oc_producer_ids | [id])
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def relatives_including_self
|
def relatives_including_self
|
||||||
|
|||||||
@@ -28,8 +28,12 @@ class EnterpriseGroup < ApplicationRecord
|
|||||||
has_one_attached :logo
|
has_one_attached :logo
|
||||||
has_one_attached :promo_image
|
has_one_attached :promo_image
|
||||||
|
|
||||||
validates :logo, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
validates :logo,
|
||||||
validates :promo_image, content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
processable_image: true,
|
||||||
|
content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
||||||
|
validates :promo_image,
|
||||||
|
processable_image: true,
|
||||||
|
content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
||||||
|
|
||||||
scope :by_position, -> { order('position ASC') }
|
scope :by_position, -> { order('position ASC') }
|
||||||
scope :on_front_page, -> { where(on_front_page: true) }
|
scope :on_front_page, -> { where(on_front_page: true) }
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class EnterpriseRelationship < ApplicationRecord
|
|||||||
|
|
||||||
after_save :update_permissions_of_child_variant_overrides
|
after_save :update_permissions_of_child_variant_overrides
|
||||||
before_destroy :revoke_all_child_variant_overrides
|
before_destroy :revoke_all_child_variant_overrides
|
||||||
|
before_destroy :destroy_related_exchanges
|
||||||
|
|
||||||
scope :with_enterprises, -> {
|
scope :with_enterprises, -> {
|
||||||
joins("
|
joins("
|
||||||
@@ -102,6 +103,10 @@ class EnterpriseRelationship < ApplicationRecord
|
|||||||
child_variant_overrides.update_all(permission_revoked_at: Time.zone.now)
|
child_variant_overrides.update_all(permission_revoked_at: Time.zone.now)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def destroy_related_exchanges
|
||||||
|
Exchange.where(sender: parent, receiver: child, incoming: true).destroy_all
|
||||||
|
end
|
||||||
|
|
||||||
def child_variant_overrides
|
def child_variant_overrides
|
||||||
VariantOverride.unscoped.for_hubs(child)
|
VariantOverride.unscoped.for_hubs(child)
|
||||||
.joins(variant: :product).where("spree_products.supplier_id IN (?)", parent)
|
.joins(variant: :product).where("spree_products.supplier_id IN (?)", parent)
|
||||||
|
|||||||
@@ -1,5 +1,15 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class EnterpriseRelationshipPermission < ApplicationRecord
|
class EnterpriseRelationshipPermission < ApplicationRecord
|
||||||
|
belongs_to :enterprise_relationship
|
||||||
default_scope { order('name') }
|
default_scope { order('name') }
|
||||||
|
before_destroy :destroy_related_exchanges
|
||||||
|
|
||||||
|
def destroy_related_exchanges
|
||||||
|
return if name != "add_to_order_cycle"
|
||||||
|
|
||||||
|
Exchange
|
||||||
|
.where(sender: enterprise_relationship.parent,
|
||||||
|
receiver: enterprise_relationship.child, incoming: true).destroy_all
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,4 +3,9 @@
|
|||||||
class ExchangeVariant < ApplicationRecord
|
class ExchangeVariant < ApplicationRecord
|
||||||
belongs_to :exchange
|
belongs_to :exchange
|
||||||
belongs_to :variant, class_name: 'Spree::Variant'
|
belongs_to :variant, class_name: 'Spree::Variant'
|
||||||
|
after_destroy :destroy_related_outgoing_variants
|
||||||
|
|
||||||
|
def destroy_related_outgoing_variants
|
||||||
|
VariantDeleter.new.destroy_related_outgoing_variants(variant_id, exchange.order_cycle)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ module ProductImport
|
|||||||
enterprise_validation(entry)
|
enterprise_validation(entry)
|
||||||
unit_fields_validation(entry)
|
unit_fields_validation(entry)
|
||||||
variant_of_product_validation(entry)
|
variant_of_product_validation(entry)
|
||||||
|
price_validation(entry)
|
||||||
|
on_hand_on_demand_validation(entry)
|
||||||
|
|
||||||
next if entry.enterprise_id.blank?
|
next if entry.enterprise_id.blank?
|
||||||
|
|
||||||
@@ -170,6 +172,11 @@ module ProductImport
|
|||||||
error: I18n.t('admin.product_import.model.blank'))
|
error: I18n.t('admin.product_import.model.blank'))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unless is_numeric(entry.units) && entry.units.to_f > 0
|
||||||
|
mark_as_invalid(entry, attribute: 'units',
|
||||||
|
error: I18n.t('admin.product_import.model.incorrect_value'))
|
||||||
|
end
|
||||||
|
|
||||||
return if import_into_inventory?
|
return if import_into_inventory?
|
||||||
|
|
||||||
# unit_type must be valid type
|
# unit_type must be valid type
|
||||||
@@ -189,6 +196,42 @@ module ProductImport
|
|||||||
error: I18n.t('admin.product_import.model.conditional_blank'))
|
error: I18n.t('admin.product_import.model.conditional_blank'))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def is_numeric(value)
|
||||||
|
return true unless Float(value, exception: false).nil?
|
||||||
|
end
|
||||||
|
|
||||||
|
def price_validation(entry)
|
||||||
|
return if is_numeric(entry.price)
|
||||||
|
|
||||||
|
error_string = if empty_or_placeholder_value(entry.price)
|
||||||
|
'admin.product_import.model.blank'
|
||||||
|
else
|
||||||
|
'admin.product_import.model.incorrect_value'
|
||||||
|
end
|
||||||
|
mark_as_invalid(entry, attribute: 'price', error: I18n.t(error_string))
|
||||||
|
end
|
||||||
|
|
||||||
|
def on_hand_on_demand_validation(entry)
|
||||||
|
on_hand_present_numeric = !empty_or_placeholder_value(entry.on_hand) &&
|
||||||
|
is_numeric(entry.on_hand)
|
||||||
|
on_hand_value = entry.on_hand&.to_i
|
||||||
|
on_demand_present_numeric = !empty_or_placeholder_value(entry.on_demand) &&
|
||||||
|
is_numeric(entry.on_demand)
|
||||||
|
on_demand_value = entry.on_demand&.to_i
|
||||||
|
|
||||||
|
return if (on_hand_present_numeric && on_hand_value >= 0) ||
|
||||||
|
(on_demand_present_numeric && on_demand_value == 1)
|
||||||
|
|
||||||
|
mark_as_invalid(entry, attribute: 'on_hand',
|
||||||
|
error: I18n.t('admin.product_import.model.incorrect_value'))
|
||||||
|
mark_as_invalid(entry, attribute: 'on_demand',
|
||||||
|
error: I18n.t('admin.product_import.model.incorrect_value'))
|
||||||
|
end
|
||||||
|
|
||||||
|
def empty_or_placeholder_value(value)
|
||||||
|
value.blank? || value.to_s.strip == "-"
|
||||||
|
end
|
||||||
|
|
||||||
def variant_of_product_validation(entry)
|
def variant_of_product_validation(entry)
|
||||||
return if entry.producer.blank? || entry.name.blank?
|
return if entry.producer.blank? || entry.name.blank?
|
||||||
|
|
||||||
@@ -293,8 +336,7 @@ module ProductImport
|
|||||||
entry.primary_taxon_id = @spreadsheet_data.categories_index[category_name]
|
entry.primary_taxon_id = @spreadsheet_data.categories_index[category_name]
|
||||||
else
|
else
|
||||||
mark_as_invalid(entry, attribute: "category",
|
mark_as_invalid(entry, attribute: "category",
|
||||||
error: I18n.t(:error_not_found_in_database,
|
error: I18n.t('admin.product_import.model.category_not_found'))
|
||||||
name: category_name))
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
36
app/models/report_blob.rb
Normal file
36
app/models/report_blob.rb
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Stores a generated report.
|
||||||
|
class ReportBlob < ActiveStorage::Blob
|
||||||
|
def self.create_for_upload_later!(filename)
|
||||||
|
# ActiveStorage discourages modifying a blob later but we need a blob
|
||||||
|
# before we know anything about the report file. It enables us to use the
|
||||||
|
# same blob in the controller to read the result.
|
||||||
|
create_before_direct_upload!(
|
||||||
|
filename: filename,
|
||||||
|
byte_size: 0,
|
||||||
|
checksum: "0",
|
||||||
|
content_type: content_type(filename),
|
||||||
|
).tap do |blob|
|
||||||
|
ActiveStorage::PurgeJob.set(wait: 1.month).perform_later(blob)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.content_type(filename)
|
||||||
|
MIME::Types.of(filename).first&.to_s || "application/octet-stream"
|
||||||
|
end
|
||||||
|
|
||||||
|
def store(content)
|
||||||
|
io = StringIO.new(content)
|
||||||
|
upload(io, identify: false)
|
||||||
|
save!
|
||||||
|
end
|
||||||
|
|
||||||
|
def content_stored?
|
||||||
|
@content_stored ||= reload.checksum != "0"
|
||||||
|
end
|
||||||
|
|
||||||
|
def result
|
||||||
|
@result ||= download
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,8 +11,10 @@ module Spree
|
|||||||
|
|
||||||
has_one_attached :attachment
|
has_one_attached :attachment
|
||||||
|
|
||||||
validates :attachment, attached: true,
|
validates :attachment,
|
||||||
content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
attached: true,
|
||||||
|
processable_image: true,
|
||||||
|
content_type: %r{\Aimage/(png|jpeg|gif|jpg|svg\+xml|webp)\Z}
|
||||||
validate :no_attachment_errors
|
validate :no_attachment_errors
|
||||||
|
|
||||||
def variant(name)
|
def variant(name)
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ module Spree
|
|||||||
presence: { if: ->(p) { %w(weight volume).include? p.variant_unit } }
|
presence: { if: ->(p) { %w(weight volume).include? p.variant_unit } }
|
||||||
validates :variant_unit_name,
|
validates :variant_unit_name,
|
||||||
presence: { if: ->(p) { p.variant_unit == 'items' } }
|
presence: { if: ->(p) { p.variant_unit == 'items' } }
|
||||||
|
validate :validate_image_for_master
|
||||||
|
|
||||||
attr_accessor :option_values_hash
|
attr_accessor :option_values_hash
|
||||||
|
|
||||||
@@ -474,5 +475,11 @@ module Spree
|
|||||||
requested = permalink.presence || permalink_was.presence || name.presence || 'product'
|
requested = permalink.presence || permalink_was.presence || name.presence || 'product'
|
||||||
self.permalink = create_unique_permalink(requested.parameterize)
|
self.permalink = create_unique_permalink(requested.parameterize)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def validate_image_for_master
|
||||||
|
return if master.images.all?(&:valid?)
|
||||||
|
|
||||||
|
errors.add(:base, I18n.t('spree.admin.products.image_not_processable'))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,8 +3,10 @@
|
|||||||
module Api
|
module Api
|
||||||
module Admin
|
module Admin
|
||||||
class OrderSerializer < ActiveModel::Serializer
|
class OrderSerializer < ActiveModel::Serializer
|
||||||
attributes :id, :number, :user_id, :full_name, :email, :phone, :completed_at,
|
include AddressDisplay
|
||||||
:completed_at_utc_iso8601, :display_total,
|
|
||||||
|
attributes :id, :number, :user_id, :full_name, :full_name_for_sorting, :email, :phone,
|
||||||
|
:completed_at, :completed_at_utc_iso8601, :display_total,
|
||||||
:edit_path, :state, :payment_state, :shipment_state,
|
:edit_path, :state, :payment_state, :shipment_state,
|
||||||
:payments_path, :ready_to_ship, :ready_to_capture, :created_at,
|
:payments_path, :ready_to_ship, :ready_to_capture, :created_at,
|
||||||
:distributor_name, :special_instructions, :display_outstanding_balance,
|
:distributor_name, :special_instructions, :display_outstanding_balance,
|
||||||
@@ -17,6 +19,14 @@ module Api
|
|||||||
object.billing_address.nil? ? "" : ( object.billing_address.full_name || "" )
|
object.billing_address.nil? ? "" : ( object.billing_address.full_name || "" )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def first_name
|
||||||
|
object.billing_address&.first_name || ""
|
||||||
|
end
|
||||||
|
|
||||||
|
def last_name
|
||||||
|
object.billing_address&.last_name || ""
|
||||||
|
end
|
||||||
|
|
||||||
def distributor_name
|
def distributor_name
|
||||||
object.distributor&.name
|
object.distributor&.name
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
module Api
|
module Api
|
||||||
class EnterpriseThinSerializer < ActiveModel::Serializer
|
class EnterpriseThinSerializer < ActiveModel::Serializer
|
||||||
attributes :name, :id, :active, :path
|
attributes :name, :id, :active, :path, :visible
|
||||||
|
|
||||||
has_one :address, serializer: Api::AddressSerializer
|
has_one :address, serializer: Api::AddressSerializer
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,15 @@ class VariantDeleter
|
|||||||
variant.destroy
|
variant.destroy
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def destroy_related_outgoing_variants(variant_id, order_cycle)
|
||||||
|
internal_variants = ExchangeVariant.where(variant_id: variant_id).
|
||||||
|
joins(:exchange).
|
||||||
|
where(
|
||||||
|
exchanges: { order_cycle: order_cycle, incoming: false }
|
||||||
|
)
|
||||||
|
internal_variants.destroy_all
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def only_variant_on_product?(variant)
|
def only_variant_on_product?(variant)
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
.report__header.print-hidden
|
.report__header.print-hidden
|
||||||
- if @report.message.present?
|
- if @report.message.present?
|
||||||
%p.report__message= @report.message
|
%p.report__message= @report.message
|
||||||
- if request.post?
|
- if request.post? && !@error
|
||||||
%button.btn-print.icon-print{ onclick: "window.print()"}= t(:report_print)
|
%button.btn-print.icon-print{ onclick: "window.print()"}= t(:report_print)
|
||||||
|
|
||||||
|
= t(@error, link: link_to(t(".report_link_label"), @error_url)) if @error
|
||||||
= @table
|
= @table
|
||||||
|
|||||||
@@ -10,11 +10,12 @@
|
|||||||
%a{"ng-click" => "triggerProductModal()", href: 'javascript:void(0)'}
|
%a{"ng-click" => "triggerProductModal()", href: 'javascript:void(0)'}
|
||||||
%span{"ng-bind" => "::product.name"}
|
%span{"ng-bind" => "::product.name"}
|
||||||
.product-description{ng: {"bind-html": "::product.description_html", click: "triggerProductModal()", show: "product.description_html.length"}}
|
.product-description{ng: {"bind-html": "::product.description_html", click: "triggerProductModal()", show: "product.description_html.length"}}
|
||||||
.product-producer
|
%div{ "ng-switch" => "enterprise.visible" }
|
||||||
= t :products_from
|
.product-producer
|
||||||
%span
|
= t :products_from
|
||||||
%enterprise-modal
|
%span{ "ng-switch-when": "hidden", "ng-bind" => "::enterprise.name"}
|
||||||
%span{"ng-bind" => "::enterprise.name"}
|
%span{ "ng-switch-default": true }
|
||||||
|
%enterprise-modal{"ng-bind" => "::enterprise.name"}
|
||||||
|
|
||||||
.product-properties.filter-shopfront.property-selectors
|
.product-properties.filter-shopfront.property-selectors
|
||||||
%filter-selector{ 'selector-set' => "productPropertySelectors", objects: "[product] | propertiesWithValuesOf" }
|
%filter-selector{ 'selector-set' => "productPropertySelectors", objects: "[product] | propertiesWithValuesOf" }
|
||||||
|
|||||||
@@ -6,6 +6,9 @@
|
|||||||
= t :shopping_producers_of_hub, hub: '{{ shopfront.name }}'
|
= t :shopping_producers_of_hub, hub: '{{ shopfront.name }}'
|
||||||
%ul.small-block-grid-1.medium-block-grid-2.large-block-grid-3
|
%ul.small-block-grid-1.medium-block-grid-2.large-block-grid-3
|
||||||
%li{"ng-repeat" => "enterprise in shopfront.producers"}
|
%li{"ng-repeat" => "enterprise in shopfront.producers"}
|
||||||
%enterprise-modal
|
%enterprise-modal{"ng-if": "enterprise.visible != 'hidden'"}
|
||||||
|
%i.ofn-i_036-producers
|
||||||
|
{{ enterprise.name }}
|
||||||
|
%span{"ng-if": "enterprise.visible == 'hidden'"}
|
||||||
%i.ofn-i_036-producers
|
%i.ofn-i_036-producers
|
||||||
{{ enterprise.name }}
|
{{ enterprise.name }}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
%h6.text-center{ 'ng-hide' => 'sharedResource' } {{ selectedUnitsVariant.full_name }}
|
%h6.text-center{ 'ng-hide' => 'sharedResource' } {{ selectedUnitsVariant.full_name }}
|
||||||
.three.columns
|
.three.columns
|
||||||
%h6.text-right
|
%h6.text-right
|
||||||
%a{ :href => '#', 'ng-click' => 'selectedUnitsVariant = {};selectedUnitsProduct = {};sharedResource=false;' }= t('admin.clear')
|
%a{ :href => '#', 'ng-click' => 'resetSelectedUnitsVariant()' }= t('admin.clear')
|
||||||
%hr
|
%hr
|
||||||
.row
|
.row
|
||||||
.one.columns.alpha
|
.one.columns.alpha
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
%a{ :href => '', 'ng-click' => "sorting.toggle('order.number')" }
|
%a{ :href => '', 'ng-click' => "sorting.toggle('order.number')" }
|
||||||
= t("admin.orders.bulk_management.order_no")
|
= t("admin.orders.bulk_management.order_no")
|
||||||
%th.full_name{ 'ng-show' => 'columns.full_name.visible' }
|
%th.full_name{ 'ng-show' => 'columns.full_name.visible' }
|
||||||
%a{ :href => '', 'ng-click' => "sorting.toggle('order.full_name')" }
|
%a{ :href => '', 'ng-click' => "sorting.toggle('order.full_name_for_sorting')" }
|
||||||
= t("admin.name")
|
= t("admin.name")
|
||||||
%th.email{ 'ng-show' => 'columns.email.visible' }
|
%th.email{ 'ng-show' => 'columns.email.visible' }
|
||||||
%a{ :href => '', 'ng-click' => "sorting.toggle('order.email')" }
|
%a{ :href => '', 'ng-click' => "sorting.toggle('order.email')" }
|
||||||
@@ -166,11 +166,11 @@
|
|||||||
= "#{t('admin.price')} (#{Spree::Money.currency_symbol})"
|
= "#{t('admin.price')} (#{Spree::Money.currency_symbol})"
|
||||||
%th.actions
|
%th.actions
|
||||||
|
|
||||||
%tr.line_item{ ng: { repeat: "line_item in filteredLineItems = ( line_items | variantFilter:selectedUnitsProduct:selectedUnitsVariant:sharedResource | orderBy:sorting.predicate:sorting.reverse )", 'class-even' => "'even'", 'class-odd' => "'odd'", attr: { id: "li_{{line_item.id}}" } } }
|
%tr.line_item{ ng: { repeat: "line_item in filteredLineItems = ( line_items | orderBy:sorting.predicate:sorting.reverse )", 'class-even' => "'even'", 'class-odd' => "'odd'", attr: { id: "li_{{line_item.id}}" } } }
|
||||||
%td.bulk
|
%td.bulk
|
||||||
%input{ :type => "checkbox", :name => 'bulk', 'ng-model' => 'line_item.checked', 'ignore-dirty' => true }
|
%input{ :type => "checkbox", :name => 'bulk', 'ng-model' => 'line_item.checked', 'ignore-dirty' => true }
|
||||||
%td.order_no{ 'ng-show' => 'columns.order_no.visible' } {{ line_item.order.number }}
|
%td.order_no{ 'ng-show' => 'columns.order_no.visible' } {{ line_item.order.number }}
|
||||||
%td.full_name{ 'ng-show' => 'columns.full_name.visible' } {{ line_item.order.full_name }}
|
%td.full_name{ 'ng-show' => 'columns.full_name.visible' } {{ line_item.order.full_name_for_sorting }}
|
||||||
%td.email{ 'ng-show' => 'columns.email.visible' } {{ line_item.order.email }}
|
%td.email{ 'ng-show' => 'columns.email.visible' } {{ line_item.order.email }}
|
||||||
%td.phone{ 'ng-show' => 'columns.phone.visible' } {{ line_item.order.phone }}
|
%td.phone{ 'ng-show' => 'columns.phone.visible' } {{ line_item.order.phone }}
|
||||||
%td.date{ 'ng-show' => 'columns.order_date.visible' } {{ line_item.order.completed_at }}
|
%td.date{ 'ng-show' => 'columns.order_date.visible' } {{ line_item.order.completed_at }}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 3px;
|
margin-right: 3px;
|
||||||
border-radius: $body-font-size/2;
|
border-radius: $body-font-size*0.5;
|
||||||
width: $body-font-size - 4px;
|
width: $body-font-size - 4px;
|
||||||
height: $body-font-size - 4px;
|
height: $body-font-size - 4px;
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,11 +1,13 @@
|
|||||||
// Grid Calculations
|
// Grid Calculations
|
||||||
// Adjust $col-gutter (space between columns, as percentage) to adjust everything else automatically
|
// Adjust $col-gutter (space between columns, as percentage) to adjust everything else automatically
|
||||||
|
|
||||||
|
@use "sass:math";
|
||||||
|
|
||||||
$col-gutter: 2;
|
$col-gutter: 2;
|
||||||
$total-gutter: $col-gutter * 15;
|
$total-gutter: $col-gutter * 15;
|
||||||
$total-colspace: 100 - $total-gutter;
|
$total-colspace: 100 - $total-gutter;
|
||||||
$gutter-width: $col-gutter / 100;
|
$gutter-width: $col-gutter * 0.01;
|
||||||
$col-width: ($total-colspace / 16) / 100;
|
$col-width: math.div($total-colspace, 16) * 0.01;
|
||||||
|
|
||||||
$col-1: $col-width;
|
$col-1: $col-width;
|
||||||
$col-2: ($col-width * 2) + $gutter-width;
|
$col-2: ($col-width * 2) + $gutter-width;
|
||||||
|
|||||||
@@ -281,7 +281,7 @@ nav.top-bar {
|
|||||||
nav .top-bar-section {
|
nav .top-bar-section {
|
||||||
ul li a,
|
ul li a,
|
||||||
.has-dropdown > a {
|
.has-dropdown > a {
|
||||||
padding: 0 ($topbar-height / 8) !important;
|
padding: 0 ($topbar-height * 0.125) !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ $brand-colour: #f27052;
|
|||||||
|
|
||||||
// Topbar
|
// Topbar
|
||||||
$topbar-height: rem-calc(64);
|
$topbar-height: rem-calc(64);
|
||||||
$topbar-link-padding: $topbar-height / 4;
|
$topbar-link-padding: $topbar-height * 0.25;
|
||||||
$topbar-arrows: false;
|
$topbar-arrows: false;
|
||||||
|
|
||||||
$topbar-bg: $white;
|
$topbar-bg: $white;
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ Openfoodnetwork::Application.configure do
|
|||||||
|
|
||||||
config.action_controller.default_url_options = {host: "localhost", port: 3000}
|
config.action_controller.default_url_options = {host: "localhost", port: 3000}
|
||||||
|
|
||||||
config.session_store :cache_store, key: "_sessions_development", compress: true, pool_size: 5, expire_after: 1.year
|
|
||||||
|
|
||||||
# :file_store is used by default when no cache store is specifically configured.
|
# :file_store is used by default when no cache store is specifically configured.
|
||||||
if !!ENV["PROFILE"] || !!ENV["DEV_CACHING"]
|
if !!ENV["PROFILE"] || !!ENV["DEV_CACHING"]
|
||||||
config.cache_store = :redis_cache_store, {
|
config.cache_store = :redis_cache_store, {
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ en:
|
|||||||
aspect_ratio_not_landscape: "must be a landscape image"
|
aspect_ratio_not_landscape: "must be a landscape image"
|
||||||
aspect_ratio_is_not: "must have an aspect ratio of %{aspect_ratio}"
|
aspect_ratio_is_not: "must have an aspect ratio of %{aspect_ratio}"
|
||||||
aspect_ratio_unknown: "has an unknown aspect ratio"
|
aspect_ratio_unknown: "has an unknown aspect ratio"
|
||||||
|
image_not_processable: "is not a valid image"
|
||||||
|
|
||||||
stripe:
|
stripe:
|
||||||
error_code:
|
error_code:
|
||||||
@@ -1440,6 +1441,16 @@ en:
|
|||||||
pack_by_customer: Pack By Customer
|
pack_by_customer: Pack By Customer
|
||||||
pack_by_supplier: Pack By Supplier
|
pack_by_supplier: Pack By Supplier
|
||||||
pack_by_product: Pack By Product
|
pack_by_product: Pack By Product
|
||||||
|
show:
|
||||||
|
report_taking_longer: >
|
||||||
|
Sorry, this report took too long to process.
|
||||||
|
It may contain a lot of data or we are busy with other reports.
|
||||||
|
You can try again later.
|
||||||
|
report_taking_longer_html: >
|
||||||
|
This report is taking longer to process.
|
||||||
|
It may contain a lot of data or we are busy with other reports.
|
||||||
|
Once it's finished, you can download it: %{link}
|
||||||
|
report_link_label: Download report (when available)
|
||||||
revenues_by_hub:
|
revenues_by_hub:
|
||||||
name: Revenues By Hub
|
name: Revenues By Hub
|
||||||
description: Revenues by hub
|
description: Revenues by hub
|
||||||
@@ -4134,6 +4145,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
|||||||
no_payment_via_admin_backend: Paypal payments cannot be captured in the Backoffice
|
no_payment_via_admin_backend: Paypal payments cannot be captured in the Backoffice
|
||||||
products:
|
products:
|
||||||
image_upload_error: "Please upload the image in JPG, PNG, GIF, SVG or WEBP format."
|
image_upload_error: "Please upload the image in JPG, PNG, GIF, SVG or WEBP format."
|
||||||
|
image_not_processable: "Image attachment is not a valid image."
|
||||||
new:
|
new:
|
||||||
title: "New Product"
|
title: "New Product"
|
||||||
new_product: "New Product"
|
new_product: "New Product"
|
||||||
|
|||||||
@@ -1360,6 +1360,10 @@ en_FR:
|
|||||||
pack_by_customer: Pack By Customer
|
pack_by_customer: Pack By Customer
|
||||||
pack_by_supplier: Pack By Supplier
|
pack_by_supplier: Pack By Supplier
|
||||||
pack_by_product: Pack By Product
|
pack_by_product: Pack By Product
|
||||||
|
show:
|
||||||
|
report_taking_longer: >
|
||||||
|
Sorry, this report took too long to process. It may contain a lot of data
|
||||||
|
or we are busy with other reports. You can try again later.
|
||||||
revenues_by_hub:
|
revenues_by_hub:
|
||||||
name: Revenues By Hub
|
name: Revenues By Hub
|
||||||
description: Revenues by hub
|
description: Revenues by hub
|
||||||
@@ -3609,6 +3613,7 @@ en_FR:
|
|||||||
shipping_categories: "Shipping Categories"
|
shipping_categories: "Shipping Categories"
|
||||||
new_shipping_category: "New Shipping Category"
|
new_shipping_category: "New Shipping Category"
|
||||||
back_to_shipping_categories: "Back To Shipping Categories"
|
back_to_shipping_categories: "Back To Shipping Categories"
|
||||||
|
editing_shipping_category: "Editing Shipping Category"
|
||||||
name: "Name"
|
name: "Name"
|
||||||
description: "Description"
|
description: "Description"
|
||||||
type: "Type"
|
type: "Type"
|
||||||
|
|||||||
@@ -1361,6 +1361,11 @@ fr:
|
|||||||
pack_by_customer: Préparation des commandes par Acheteur
|
pack_by_customer: Préparation des commandes par Acheteur
|
||||||
pack_by_supplier: Préparation des commandes par Producteur
|
pack_by_supplier: Préparation des commandes par Producteur
|
||||||
pack_by_product: Préparation des commandes par Produit
|
pack_by_product: Préparation des commandes par Produit
|
||||||
|
show:
|
||||||
|
report_taking_longer: >
|
||||||
|
Désolée, ce rapport met trop de temps à se charger, probablement parce
|
||||||
|
qu'il contient une grande quantité de données ou que d'autres rapports
|
||||||
|
sont en cours de téléchargement. Merci de réessayer plus tard.
|
||||||
revenues_by_hub:
|
revenues_by_hub:
|
||||||
name: CA par boutique
|
name: CA par boutique
|
||||||
description: CA par boutique
|
description: CA par boutique
|
||||||
@@ -3664,6 +3669,7 @@ fr:
|
|||||||
shipping_categories: "Conditions de transport"
|
shipping_categories: "Conditions de transport"
|
||||||
new_shipping_category: "Nouvelle condition de transport"
|
new_shipping_category: "Nouvelle condition de transport"
|
||||||
back_to_shipping_categories: "Retour aux conditions de transport"
|
back_to_shipping_categories: "Retour aux conditions de transport"
|
||||||
|
editing_shipping_category: "Modifier condition de transport"
|
||||||
name: "Produit/Variante"
|
name: "Produit/Variante"
|
||||||
description: "Description"
|
description: "Description"
|
||||||
type: "Catégorie"
|
type: "Catégorie"
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ it:
|
|||||||
supplier_only: Solo Fornitore
|
supplier_only: Solo Fornitore
|
||||||
has_shopfront: Ha una Vetrina
|
has_shopfront: Ha una Vetrina
|
||||||
weight: Peso
|
weight: Peso
|
||||||
volume: Volume
|
volume: Acquisto di gruppo
|
||||||
items: Prodotti
|
items: Prodotti
|
||||||
summary: Sommario
|
summary: Sommario
|
||||||
detailed: Dettaglio
|
detailed: Dettaglio
|
||||||
@@ -487,7 +487,7 @@ it:
|
|||||||
tags: Etichetta
|
tags: Etichetta
|
||||||
variant: Variante
|
variant: Variante
|
||||||
weight: Peso
|
weight: Peso
|
||||||
volume: Volume
|
volume: Acquisto di gruppo
|
||||||
items: Prodotti
|
items: Prodotti
|
||||||
select_all: Seleziona tutto
|
select_all: Seleziona tutto
|
||||||
quick_search: Ricerca veloce
|
quick_search: Ricerca veloce
|
||||||
|
|||||||
@@ -17,7 +17,19 @@ function hotfixPostcssLoaderConfig (subloader) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addQuietDepsToSassLoader (subloader) {
|
||||||
|
if (subloader.loader === 'sass-loader') {
|
||||||
|
subloader.options.sassOptions = {
|
||||||
|
...subloader.options.sassOptions,
|
||||||
|
quietDeps: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
environment.loaders.keys().forEach(loaderName => {
|
environment.loaders.keys().forEach(loaderName => {
|
||||||
const loader = environment.loaders.get(loaderName);
|
const loader = environment.loaders.get(loaderName);
|
||||||
|
if (loaderName === 'sass') {
|
||||||
|
loader.use.forEach(addQuietDepsToSassLoader);
|
||||||
|
}
|
||||||
loader.use.forEach(hotfixPostcssLoaderConfig);
|
loader.use.forEach(hotfixPostcssLoaderConfig);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
class ActivateSplitCheckoutByDefault < ActiveRecord::Migration[7.0]
|
||||||
|
def change
|
||||||
|
Flipper.enable(:split_checkout)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema[7.0].define(version: 2023_03_29_080357) do
|
ActiveRecord::Schema[7.0].define(version: 2023_04_13_111157) do
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "pg_stat_statements"
|
enable_extension "pg_stat_statements"
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
|||||||
@@ -4,6 +4,20 @@ module Reporting
|
|||||||
module Reports
|
module Reports
|
||||||
module Customers
|
module Customers
|
||||||
class Addresses < Base
|
class Addresses < Base
|
||||||
|
def query_result
|
||||||
|
super.group_by do |order|
|
||||||
|
{
|
||||||
|
first_name: order.billing_address.firstname,
|
||||||
|
last_name: order.billing_address.lastname,
|
||||||
|
billing_address: order.billing_address.address_and_city,
|
||||||
|
email: order.email,
|
||||||
|
phone: order.billing_address.phone,
|
||||||
|
hub_id: order.distributor_id,
|
||||||
|
shipping_method_id: order.shipping_method&.id,
|
||||||
|
}
|
||||||
|
end.values.map(&:first)
|
||||||
|
end
|
||||||
|
|
||||||
def columns
|
def columns
|
||||||
{
|
{
|
||||||
first_name: proc { |order| order.billing_address.firstname },
|
first_name: proc { |order| order.billing_address.firstname },
|
||||||
|
|||||||
@@ -4,6 +4,17 @@ module Reporting
|
|||||||
module Reports
|
module Reports
|
||||||
module Customers
|
module Customers
|
||||||
class MailingList < Base
|
class MailingList < Base
|
||||||
|
def query_result
|
||||||
|
super.group_by do |order|
|
||||||
|
{
|
||||||
|
email: order.email,
|
||||||
|
first_name: order.billing_address.firstname,
|
||||||
|
last_name: order.billing_address.lastname,
|
||||||
|
suburb: order.billing_address.city,
|
||||||
|
}
|
||||||
|
end.values.map(&:first)
|
||||||
|
end
|
||||||
|
|
||||||
def columns
|
def columns
|
||||||
{
|
{
|
||||||
email: proc { |order| order.email },
|
email: proc { |order| order.email },
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module Reporting
|
|||||||
end
|
end
|
||||||
|
|
||||||
def custom_headers
|
def custom_headers
|
||||||
data_attributes.map { |attr| [attr, I18n.t("header.#{attr}", scope: i18n_scope)] }.to_h
|
data_attributes.index_with { |attr| I18n.t("header.#{attr}", scope: i18n_scope) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def i18n_scope
|
def i18n_scope
|
||||||
|
|||||||
@@ -11,6 +11,12 @@ module Reporting
|
|||||||
def query_result
|
def query_result
|
||||||
search.result.group_by { |order| [order.payment_state, order.distributor] }.values
|
search.result.group_by { |order| [order.payment_state, order.distributor] }.values
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def payment_state(order)
|
||||||
|
I18n.t "spree.payment_states.#{order.payment_state}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ module Reporting
|
|||||||
class ItemisedPaymentTotals < Base
|
class ItemisedPaymentTotals < Base
|
||||||
def columns
|
def columns
|
||||||
{
|
{
|
||||||
payment_state: proc { |orders| orders.first.payment_state },
|
payment_state: proc { |orders| payment_state(orders.first) },
|
||||||
distributor: proc { |orders| orders.first.distributor.name },
|
distributor: proc { |orders| orders.first.distributor.name },
|
||||||
product_total_price: proc { |orders| orders.to_a.sum(&:item_total) },
|
product_total_price: proc { |orders| orders.to_a.sum(&:item_total) },
|
||||||
shipping_total_price: proc { |orders| orders.sum(&:ship_total) },
|
shipping_total_price: proc { |orders| orders.sum(&:ship_total) },
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ module Reporting
|
|||||||
class PaymentTotals < Base
|
class PaymentTotals < Base
|
||||||
def columns
|
def columns
|
||||||
{
|
{
|
||||||
payment_state: proc { |orders| orders.first.payment_state },
|
payment_state: proc { |orders| payment_state(orders.first) },
|
||||||
distributor: proc { |orders| orders.first.distributor.name },
|
distributor: proc { |orders| orders.first.distributor.name },
|
||||||
product_total_price: proc { |orders| orders.to_a.sum(&:item_total) },
|
product_total_price: proc { |orders| orders.to_a.sum(&:item_total) },
|
||||||
shipping_total_price: proc { |orders| orders.sum(&:ship_total) },
|
shipping_total_price: proc { |orders| orders.sum(&:ship_total) },
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module Reporting
|
|||||||
|
|
||||||
def columns
|
def columns
|
||||||
{
|
{
|
||||||
payment_state: proc { |payments| payments.first.order.payment_state },
|
payment_state: proc { |payments| payment_state(payments.first.order) },
|
||||||
distributor: proc { |payments| payments.first.order.distributor.name },
|
distributor: proc { |payments| payments.first.order.distributor.name },
|
||||||
payment_type: proc { |payments| payments.first.payment_method.name },
|
payment_type: proc { |payments| payments.first.payment_method.name },
|
||||||
total_price: proc { |payments| payments.sum(&:amount) }
|
total_price: proc { |payments| payments.sum(&:amount) }
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ module Reporting
|
|||||||
order(query_result_row).all_adjustments
|
order(query_result_row).all_adjustments
|
||||||
.tax
|
.tax
|
||||||
.where(originator_id: tax_rate_id(query_result_row))
|
.where(originator_id: tax_rate_id(query_result_row))
|
||||||
.pluck('sum(amount)').first || 0
|
.pick('sum(amount)') || 0
|
||||||
end
|
end
|
||||||
|
|
||||||
def total_incl_tax(query_result_row)
|
def total_incl_tax(query_result_row)
|
||||||
|
|||||||
@@ -19,12 +19,14 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/preset-env": "^7.18.2",
|
"@babel/core": "^7.21.4",
|
||||||
"@floating-ui/dom": "^1.2.5",
|
"@babel/plugin-transform-runtime": "^7.21.4",
|
||||||
|
"@babel/preset-env": "^7.21.4",
|
||||||
|
"@floating-ui/dom": "^1.2.6",
|
||||||
"@hotwired/turbo": "^7.3.0",
|
"@hotwired/turbo": "^7.3.0",
|
||||||
"@rails/webpacker": "5.4.4",
|
"@rails/webpacker": "5.4.4",
|
||||||
"babel-loader": "^8.2.3",
|
"babel-loader": "^8.2.3",
|
||||||
"cable_ready": "5.0.0-rc2",
|
"cable_ready": "5.0.0",
|
||||||
"debounced": "^0.0.5",
|
"debounced": "^0.0.5",
|
||||||
"flatpickr": "^4.6.9",
|
"flatpickr": "^4.6.9",
|
||||||
"foundation-sites": "^5.5.2",
|
"foundation-sites": "^5.5.2",
|
||||||
|
|||||||
@@ -57,6 +57,24 @@ RSpec.configure do |config|
|
|||||||
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
||||||
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
||||||
|
|
||||||
|
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
||||||
|
# examples within a transaction, remove the following line or assign false
|
||||||
|
# instead of true.
|
||||||
|
#
|
||||||
|
# Setting this to true keeps the database clean by rolling back any changes.
|
||||||
|
config.use_transactional_fixtures = true
|
||||||
|
|
||||||
|
# Some tests don't work within a transaction. Then we use DatabaseCleaner.
|
||||||
|
config.before(:each, concurrency: true) do
|
||||||
|
config.use_transactional_fixtures = false
|
||||||
|
DatabaseCleaner.strategy = :deletion, { except: ['spree_countries', 'spree_states'] }
|
||||||
|
DatabaseCleaner.start
|
||||||
|
end
|
||||||
|
config.append_after(:each, concurrency: true) do
|
||||||
|
DatabaseCleaner.clean
|
||||||
|
config.use_transactional_fixtures = true
|
||||||
|
end
|
||||||
|
|
||||||
# If true, the base class of anonymous controllers will be inferred
|
# If true, the base class of anonymous controllers will be inferred
|
||||||
# automatically. This will be the default behavior in future versions of
|
# automatically. This will be the default behavior in future versions of
|
||||||
# rspec-rails.
|
# rspec-rails.
|
||||||
@@ -124,6 +142,7 @@ RSpec.configure do |config|
|
|||||||
|
|
||||||
config.infer_spec_type_from_file_location!
|
config.infer_spec_type_from_file_location!
|
||||||
|
|
||||||
|
# Helpers
|
||||||
config.include FactoryBot::Syntax::Methods
|
config.include FactoryBot::Syntax::Methods
|
||||||
config.include JsonSpec::Helpers
|
config.include JsonSpec::Helpers
|
||||||
|
|
||||||
@@ -141,6 +160,13 @@ RSpec.configure do |config|
|
|||||||
config.include ActiveJob::TestHelper
|
config.include ActiveJob::TestHelper
|
||||||
config.include ReportsHelper
|
config.include ReportsHelper
|
||||||
|
|
||||||
|
config.include ViewComponent::TestHelpers, type: :component
|
||||||
|
|
||||||
|
config.include ControllerRequestsHelper, type: :controller
|
||||||
|
config.include Devise::Test::ControllerHelpers, type: :controller
|
||||||
|
config.include OpenFoodNetwork::ApiHelper, type: :controller
|
||||||
|
config.include OpenFoodNetwork::ControllerHelper, type: :controller
|
||||||
|
|
||||||
config.include Features::DatepickerHelper, type: :system
|
config.include Features::DatepickerHelper, type: :system
|
||||||
config.include DownloadsHelper, type: :system
|
config.include DownloadsHelper, type: :system
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ module Admin
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "and enterprise_id is given in params" do
|
context "and enterprise_id is given in params" do
|
||||||
|
let(:user){ enterprise.users.first }
|
||||||
|
let(:customers){ Customer.managed_by(user).where(enterprise_id: enterprise.id) }
|
||||||
let(:params) { { format: :json, enterprise_id: enterprise.id } }
|
let(:params) { { format: :json, enterprise_id: enterprise.id } }
|
||||||
|
|
||||||
it "scopes @collection to customers of that enterprise" do
|
it "scopes @collection to customers of that enterprise" do
|
||||||
@@ -45,7 +47,7 @@ module Admin
|
|||||||
it 'calls CustomersWithBalance' do
|
it 'calls CustomersWithBalance' do
|
||||||
customers_with_balance = instance_double(CustomersWithBalance)
|
customers_with_balance = instance_double(CustomersWithBalance)
|
||||||
allow(CustomersWithBalance)
|
allow(CustomersWithBalance)
|
||||||
.to receive(:new).with(Customer.of(enterprise)) { customers_with_balance }
|
.to receive(:new).with(customers) { customers_with_balance }
|
||||||
|
|
||||||
expect(customers_with_balance).to receive(:query) { Customer.none }
|
expect(customers_with_balance).to receive(:query) { Customer.none }
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ describe Api::V0::ProductImagesController, type: :controller do
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect(response.status).to eq 201
|
expect(response.status).to eq 201
|
||||||
expect(product_without_image.images.first.id).to eq json_response['id']
|
expect(product_without_image.reload.images.first.id).to eq json_response['id']
|
||||||
end
|
end
|
||||||
|
|
||||||
it "updates an existing product image" do
|
it "updates an existing product image" do
|
||||||
@@ -34,7 +34,7 @@ describe Api::V0::ProductImagesController, type: :controller do
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect(response.status).to eq 200
|
expect(response.status).to eq 200
|
||||||
expect(product_with_image.images.first.id).to eq json_response['id']
|
expect(product_with_image.reload.images.first.id).to eq json_response['id']
|
||||||
end
|
end
|
||||||
|
|
||||||
it "reports errors when saving fails" do
|
it "reports errors when saving fails" do
|
||||||
|
|||||||
@@ -3,34 +3,37 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe ReportJob do
|
describe ReportJob do
|
||||||
let(:report_args) { [report_class, user, params, format] }
|
let(:report_args) { [report_class, user, params, format, blob] }
|
||||||
let(:report_class) { Reporting::Reports::UsersAndEnterprises::Base }
|
let(:report_class) { Reporting::Reports::UsersAndEnterprises::Base }
|
||||||
let(:user) { enterprise.owner }
|
let(:user) { enterprise.owner }
|
||||||
let(:enterprise) { create(:enterprise) }
|
let(:enterprise) { create(:enterprise) }
|
||||||
let(:params) { {} }
|
let(:params) { {} }
|
||||||
let(:format) { :csv }
|
let(:format) { :csv }
|
||||||
|
let(:blob) { ReportBlob.create_for_upload_later!("report.csv") }
|
||||||
|
|
||||||
it "generates a report" do
|
it "generates a report" do
|
||||||
job = ReportJob.new
|
job = perform_enqueued_jobs(only: ReportJob) do
|
||||||
job.perform(*report_args)
|
ReportJob.perform_later(*report_args)
|
||||||
expect_csv_report(job)
|
end
|
||||||
|
expect_csv_report
|
||||||
end
|
end
|
||||||
|
|
||||||
it "enqueues a job for asynch processing" do
|
it "enqueues a job for async processing" do
|
||||||
job = ReportJob.perform_later(*report_args)
|
job = ReportJob.perform_later(*report_args)
|
||||||
expect(job.done?).to eq false
|
expect(blob.content_stored?).to eq false
|
||||||
|
|
||||||
# This performs the job in the same process but that's good enought for
|
perform_enqueued_jobs(only: ReportJob)
|
||||||
# testing the job code. I hope that we can rely on the job worker.
|
|
||||||
ActiveJob::Base.queue_adapter.perform_enqueued_jobs = true
|
|
||||||
job.retry_job
|
|
||||||
|
|
||||||
expect(job.done?).to eq true
|
expect(blob.content_stored?).to eq true
|
||||||
expect_csv_report(job)
|
expect_csv_report
|
||||||
end
|
end
|
||||||
|
|
||||||
def expect_csv_report(job)
|
def expect_csv_report
|
||||||
table = CSV.parse(job.result)
|
blob.reload
|
||||||
|
expect(blob.filename.to_s).to eq "report.csv"
|
||||||
|
expect(blob.content_type).to eq "text/csv"
|
||||||
|
|
||||||
|
table = CSV.parse(blob.result)
|
||||||
expect(table[0][1]).to eq "Relationship"
|
expect(table[0][1]).to eq "Relationship"
|
||||||
expect(table[1][1]).to eq "owns"
|
expect(table[1][1]).to eq "owns"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,6 +32,31 @@ module Reporting
|
|||||||
"test@test.com", "Firsty", "Lasty", "Suburbia"
|
"test@test.com", "Firsty", "Lasty", "Suburbia"
|
||||||
]])
|
]])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when there are multiple orders for the same customer" do
|
||||||
|
let!(:address) {
|
||||||
|
create(:bill_address, firstname: "Firsty",
|
||||||
|
lastname: "Lasty", city: "Suburbia")
|
||||||
|
}
|
||||||
|
let!(:order1) {
|
||||||
|
create(:order_with_totals_and_distribution, :completed, bill_address: address)
|
||||||
|
}
|
||||||
|
let!(:order2) {
|
||||||
|
create(:order_with_totals_and_distribution, :completed, bill_address: address)
|
||||||
|
}
|
||||||
|
before do
|
||||||
|
[order1, order2].each do |order|
|
||||||
|
order.update!(email: "test@test.com")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
it "returns only one row per customer" do
|
||||||
|
expect(subject.query_result).to match_array [order1]
|
||||||
|
expect(subject.table_rows.size).to eq(1)
|
||||||
|
expect(subject.table_rows).to eq([[
|
||||||
|
"test@test.com", "Firsty", "Lasty", "Suburbia"
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "addresses report" do
|
describe "addresses report" do
|
||||||
@@ -57,6 +82,89 @@ module Reporting
|
|||||||
o.shipping_method.name
|
o.shipping_method.name
|
||||||
]])
|
]])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "when there are multiple orders for the same customer" do
|
||||||
|
let!(:a) { create(:bill_address) }
|
||||||
|
let!(:d){ create(:distributor_enterprise) }
|
||||||
|
let!(:sm) { create(:shipping_method, distributors: [d]) }
|
||||||
|
let!(:o1) {
|
||||||
|
create(:order_with_totals_and_distribution, :completed, distributor: d, bill_address: a, shipping_method: sm)
|
||||||
|
}
|
||||||
|
let!(:o2) {
|
||||||
|
create(:order_with_totals_and_distribution, :completed, distributor: d, bill_address: a, shipping_method: sm)
|
||||||
|
}
|
||||||
|
before do
|
||||||
|
[o1, o2].each do |order|
|
||||||
|
order.update!(email: "test@test.com")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns only one row per customer" do
|
||||||
|
expect(subject.query_result).to match_array [o1]
|
||||||
|
expect(subject.table_rows.size).to eq(1)
|
||||||
|
expect(subject.table_rows).to eq([[
|
||||||
|
a.firstname, a.lastname,
|
||||||
|
[a.address1, a.address2, a.city].join(" "),
|
||||||
|
o1.email, a.phone, d.name,
|
||||||
|
[d.address.address1, d.address.address2, d.address.city].join(" "),
|
||||||
|
o1.shipping_method.name
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
|
||||||
|
context "orders from different hubs" do
|
||||||
|
let!(:d2) { create(:distributor_enterprise) }
|
||||||
|
let!(:sm2) { create(:shipping_method, distributors: [d2]) }
|
||||||
|
let!(:o2) {
|
||||||
|
create(:order_with_totals_and_distribution, :completed, distributor: d2, bill_address: a, shipping_method: sm2)
|
||||||
|
}
|
||||||
|
|
||||||
|
it "returns one row per customer per hub" do
|
||||||
|
expect(subject.query_result.size).to eq(2)
|
||||||
|
expect(subject.table_rows.size).to eq(2)
|
||||||
|
expect(subject.table_rows).to eq([[
|
||||||
|
a.firstname, a.lastname,
|
||||||
|
[a.address1, a.address2, a.city].join(" "),
|
||||||
|
o1.email, a.phone, d.name,
|
||||||
|
[d.address.address1, d.address.address2, d.address.city].join(" "),
|
||||||
|
o1.shipping_method.name
|
||||||
|
], [
|
||||||
|
a.firstname, a.lastname,
|
||||||
|
[a.address1, a.address2, a.city].join(" "),
|
||||||
|
o2.email, a.phone, d2.name,
|
||||||
|
[d2.address.address1, d2.address.address2, d2.address.city].join(" "),
|
||||||
|
o2.shipping_method.name
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "orders with different shipping methods" do
|
||||||
|
let!(:sm2) { create(:shipping_method, distributors: [d]) }
|
||||||
|
let!(:o2) {
|
||||||
|
create(:order_with_totals_and_distribution, :completed, distributor: d, bill_address: a, shipping_method: sm2)
|
||||||
|
}
|
||||||
|
before do
|
||||||
|
o2.select_shipping_method(sm2.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns one row per customer per shipping method" do
|
||||||
|
expect(subject.query_result.size).to eq(2)
|
||||||
|
expect(subject.table_rows.size).to eq(2)
|
||||||
|
expect(subject.table_rows).to eq([[
|
||||||
|
a.firstname, a.lastname,
|
||||||
|
[a.address1, a.address2, a.city].join(" "),
|
||||||
|
o1.email, a.phone, d.name,
|
||||||
|
[d.address.address1, d.address.address2, d.address.city].join(" "),
|
||||||
|
o1.shipping_method.name
|
||||||
|
], [
|
||||||
|
a.firstname, a.lastname,
|
||||||
|
[a.address1, a.address2, a.city].join(" "),
|
||||||
|
o2.email, a.phone, d.name,
|
||||||
|
[d.address.address1, d.address.address2, d.address.city].join(" "),
|
||||||
|
sm2.name
|
||||||
|
]])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "fetching orders" do
|
describe "fetching orders" do
|
||||||
|
|||||||
@@ -2,13 +2,11 @@
|
|||||||
|
|
||||||
require 'open_food_network/scope_variant_to_hub'
|
require 'open_food_network/scope_variant_to_hub'
|
||||||
|
|
||||||
module Spree
|
class ShipmentPreview < ActionMailer::Preview
|
||||||
class ShipmentPreview < ActionMailer::Preview
|
def shipped
|
||||||
def shipped
|
shipment =
|
||||||
shipment =
|
Spree::Shipment.where.not(tracking: [nil, ""]).last ||
|
||||||
Shipment.where.not(tracking: [nil, ""]).last ||
|
Spree::Shipment.last
|
||||||
Shipment.last
|
Spree::ShipmentMailer.shipped_email(shipment, delivery: true)
|
||||||
ShipmentMailer.shipped_email(shipment)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -69,4 +69,47 @@ describe Customer, type: :model do
|
|||||||
expect(c.user).to eq user2
|
expect(c.user).to eq user2
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'scopes' do
|
||||||
|
context 'managed_by' do
|
||||||
|
let!(:user) { create(:user) }
|
||||||
|
let!(:enterprise) { create(:enterprise, owner: user) }
|
||||||
|
let!(:customer) { create(:customer, enterprise: enterprise, user: user) }
|
||||||
|
let!(:customer1) { create(:customer, enterprise: enterprise) }
|
||||||
|
|
||||||
|
let!(:user1) { create(:user) }
|
||||||
|
let!(:enterprise1) { create(:enterprise, owner: user1) }
|
||||||
|
let!(:customer2) { create(:customer, enterprise: enterprise1, user: user1) }
|
||||||
|
|
||||||
|
let(:guest) { Spree::User.new }
|
||||||
|
|
||||||
|
context 'with user who has edit profile permission on enterprise via enterprise2' do
|
||||||
|
let!(:user3) { create(:user) }
|
||||||
|
let!(:enterprise2) { create(:enterprise, owner: user3) }
|
||||||
|
|
||||||
|
it 'returns customers managed by the user' do
|
||||||
|
EnterpriseRelationship.create!(parent: enterprise2, child: enterprise,
|
||||||
|
permissions_list: [:edit_profile])
|
||||||
|
expect(Customer.managed_by(user)).to match_array [customer, customer1]
|
||||||
|
expect(Customer.managed_by(user1)).to match_array(customer2)
|
||||||
|
expect(Customer.managed_by(user3)).to match_array([])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns customers of managed enterprises' do
|
||||||
|
user2 = create(:user)
|
||||||
|
EnterpriseRole.create!(user: user2, enterprise: enterprise)
|
||||||
|
expect(Customer.managed_by(user2)).to match_array [customer, customer1]
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns all customers if the user is an admin' do
|
||||||
|
admin = create(:admin_user)
|
||||||
|
expect(Customer.managed_by(admin)).to match_array [customer, customer1, customer2]
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'returns no customers if the user is non-persisted user object' do
|
||||||
|
expect(Customer.managed_by(guest)).to match_array []
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ describe EnterpriseRelationship do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "callbacks" do
|
describe "callbacks" do
|
||||||
context "updating variant override permissions" do
|
describe "updating variant override permissions" do
|
||||||
let(:hub) { create(:distributor_enterprise) }
|
let(:hub) { create(:distributor_enterprise) }
|
||||||
let(:producer) { create(:supplier_enterprise) }
|
let(:producer) { create(:supplier_enterprise) }
|
||||||
let(:some_other_producer) { create(:supplier_enterprise) }
|
let(:some_other_producer) { create(:supplier_enterprise) }
|
||||||
@@ -255,5 +255,101 @@ describe EnterpriseRelationship do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
describe "updating order cycles" do
|
||||||
|
let(:hub) { create(:distributor_enterprise) }
|
||||||
|
let(:producer) { create(:supplier_enterprise) }
|
||||||
|
let(:order_cycle) { create(:simple_order_cycle) }
|
||||||
|
let(:some_other_producer) { create(:supplier_enterprise) }
|
||||||
|
|
||||||
|
context "when order_cycle permission is present" do
|
||||||
|
let!(:er) {
|
||||||
|
create(:enterprise_relationship, child: hub, parent: producer,
|
||||||
|
permissions_list: [
|
||||||
|
:add_to_order_cycle,
|
||||||
|
:create_variant_overrides
|
||||||
|
] )
|
||||||
|
}
|
||||||
|
let!(:incoming_external_exchange) {
|
||||||
|
order_cycle.exchanges.create! sender: producer, receiver: hub, incoming: true
|
||||||
|
}
|
||||||
|
let!(:other_external_exchange) {
|
||||||
|
order_cycle.exchanges.create! sender: some_other_producer, receiver: hub, incoming: true
|
||||||
|
}
|
||||||
|
let!(:incoming_internal_exchange) {
|
||||||
|
order_cycle.exchanges.create! sender: hub, receiver: hub, incoming: true
|
||||||
|
}
|
||||||
|
let!(:outgoing_internal_exchange) {
|
||||||
|
order_cycle.exchanges.create! sender: hub, receiver: hub, incoming: false
|
||||||
|
}
|
||||||
|
let!(:variant) { create(:variant) }
|
||||||
|
let!(:some_other_variant) { create(:variant) }
|
||||||
|
let!(:incoming_external_variant) {
|
||||||
|
incoming_external_exchange.exchange_variants.create!(
|
||||||
|
exchange: incoming_external_exchange, variant: variant
|
||||||
|
)
|
||||||
|
}
|
||||||
|
let!(:incoming_internal_only_variant) {
|
||||||
|
incoming_internal_exchange.exchange_variants.create!(
|
||||||
|
exchange: incoming_internal_exchange, variant: some_other_variant
|
||||||
|
)
|
||||||
|
}
|
||||||
|
let!(:outgoing_internal_variant) {
|
||||||
|
outgoing_internal_exchange.exchange_variants.create!(
|
||||||
|
exchange: outgoing_internal_exchange, variant: variant
|
||||||
|
)
|
||||||
|
}
|
||||||
|
let!(:outgoing_internal_only_variant) {
|
||||||
|
outgoing_internal_exchange.exchange_variants.create!(
|
||||||
|
exchange: outgoing_internal_exchange, variant: some_other_variant
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
# We need to destroy the exchange variants on all order cycles related to the ER if
|
||||||
|
# 'add_to_order_cycle' permission is removed. If they are left on the order cycle, the
|
||||||
|
# Taxons of the variants will still appear on the /shops page, despite the hub not
|
||||||
|
# actually offering the variants anymore.
|
||||||
|
context "removing exchanges and exchange variants" do
|
||||||
|
context "when the enterprise relationship is destroyed" do
|
||||||
|
before { er.destroy }
|
||||||
|
it "should destroy all exchanges and exchange variants related to ER" do
|
||||||
|
expect(Exchange.exists?(incoming_external_exchange.id)).to be false
|
||||||
|
expect(Exchange.exists?(other_external_exchange.id)).to be true
|
||||||
|
expect(ExchangeVariant.exists?(incoming_external_variant.id)).to be false
|
||||||
|
expect(ExchangeVariant.exists?(outgoing_internal_variant.id)).to be false
|
||||||
|
expect(ExchangeVariant.exists?(incoming_internal_only_variant.id)).to be true
|
||||||
|
expect(ExchangeVariant.exists?(outgoing_internal_only_variant.id)).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "and is then removed" do
|
||||||
|
before { er.permissions_list = [:create_variant_overrides]; er.save! }
|
||||||
|
it "should destroy all exchanges and exchange variants related to ER" do
|
||||||
|
expect(Exchange.exists?(incoming_external_exchange.id)).to be false
|
||||||
|
expect(Exchange.exists?(other_external_exchange.id)).to be true
|
||||||
|
expect(ExchangeVariant.exists?(incoming_external_variant.id)).to be false
|
||||||
|
expect(ExchangeVariant.exists?(outgoing_internal_variant.id)).to be false
|
||||||
|
expect(ExchangeVariant.exists?(incoming_internal_only_variant.id)).to be true
|
||||||
|
expect(ExchangeVariant.exists?(outgoing_internal_only_variant.id)).to be true
|
||||||
|
end
|
||||||
|
|
||||||
|
it "should not affect other exchanges or order cycles" do
|
||||||
|
expect(Exchange.exists?(outgoing_internal_exchange.id)).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "and then some other permission is removed" do
|
||||||
|
before { er.permissions_list = [:add_to_order_cycle]; er.save! }
|
||||||
|
it "should have no effect on existing exchanges" do
|
||||||
|
expect(Exchange.exists?(incoming_external_exchange.id)).to be true
|
||||||
|
expect(Exchange.exists?(other_external_exchange.id)).to be true
|
||||||
|
expect(ExchangeVariant.exists?(incoming_external_variant.id)).to be true
|
||||||
|
expect(ExchangeVariant.exists?(outgoing_internal_variant.id)).to be true
|
||||||
|
expect(ExchangeVariant.exists?(incoming_internal_only_variant.id)).to be true
|
||||||
|
expect(ExchangeVariant.exists?(outgoing_internal_only_variant.id)).to be true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ describe ProductImport::EntryValidator do
|
|||||||
enterprise_id: enterprise.id,
|
enterprise_id: enterprise.id,
|
||||||
producer: enterprise,
|
producer: enterprise,
|
||||||
producer_id: enterprise.id,
|
producer_id: enterprise.id,
|
||||||
distributor: enterprise
|
distributor: enterprise,
|
||||||
|
price: "1.0",
|
||||||
|
on_hand: "1"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -51,7 +53,9 @@ describe ProductImport::EntryValidator do
|
|||||||
enterprise_id: enterprise.id,
|
enterprise_id: enterprise.id,
|
||||||
producer: enterprise,
|
producer: enterprise,
|
||||||
producer_id: enterprise.id,
|
producer_id: enterprise.id,
|
||||||
distributor: enterprise
|
distributor: enterprise,
|
||||||
|
price: "1.0",
|
||||||
|
on_hand: "1"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -99,7 +103,7 @@ describe ProductImport::EntryValidator do
|
|||||||
it "validates a product" do
|
it "validates a product" do
|
||||||
entries = [potato_variant]
|
entries = [potato_variant]
|
||||||
entry_validator.validate_all(entries)
|
entry_validator.validate_all(entries)
|
||||||
expect(potato_variant.errors.count).to eq 1
|
expect(potato_variant.errors.count).to eq 4
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -677,7 +677,7 @@ describe ProductImport::ProductImporter do
|
|||||||
let(:csv_data) {
|
let(:csv_data) {
|
||||||
CSV.generate do |csv|
|
CSV.generate do |csv|
|
||||||
csv << ["name", "display_name", "distributor", "producer", "on_hand", "price", "units"]
|
csv << ["name", "display_name", "distributor", "producer", "on_hand", "price", "units"]
|
||||||
csv << ["Oats", "Porridge Oats", enterprise2.name, enterprise.name, "900", "", "500"]
|
csv << ["Oats", "Porridge Oats", enterprise2.name, enterprise.name, "900", "1.0", "500"]
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
let(:importer) { import_data csv_data, import_into: 'inventories' }
|
let(:importer) { import_data csv_data, import_into: 'inventories' }
|
||||||
@@ -705,7 +705,7 @@ describe ProductImport::ProductImporter do
|
|||||||
CSV.generate do |csv|
|
CSV.generate do |csv|
|
||||||
csv << ["name", "distributor", "producer", "on_hand", "price", "units",
|
csv << ["name", "distributor", "producer", "on_hand", "price", "units",
|
||||||
"variant_unit_name"]
|
"variant_unit_name"]
|
||||||
csv << ["Cabbage", enterprise2.name, enterprise.name, "900", "", "1", "Whole"]
|
csv << ["Cabbage", enterprise2.name, enterprise.name, "900", "1.0", "1", "Whole"]
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
let(:importer) { import_data csv_data, import_into: 'inventories' }
|
let(:importer) { import_data csv_data, import_into: 'inventories' }
|
||||||
|
|||||||
@@ -460,6 +460,25 @@ module Spree
|
|||||||
expect(product).not_to be_valid
|
expect(product).not_to be_valid
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#validate_image_for_master" do
|
||||||
|
let(:product) { build_stubbed(:simple_product) }
|
||||||
|
|
||||||
|
context "when the image attached to the master variant is invalid" do
|
||||||
|
before { product.master.images.new.errors.add(:image_not_processable, "invalid") }
|
||||||
|
|
||||||
|
it "adds an error message to the base object" do
|
||||||
|
expect(product).not_to be_valid
|
||||||
|
expect(product.errors[:base]).to include('Image attachment is not a valid image.')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when master variant is valid" do
|
||||||
|
it "returns true" do
|
||||||
|
expect(product).to be_valid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "callbacks" do
|
describe "callbacks" do
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ require "swagger_helper"
|
|||||||
describe "Customers", type: :request do
|
describe "Customers", type: :request do
|
||||||
let!(:enterprise1) { create(:enterprise, name: "The Farm") }
|
let!(:enterprise1) { create(:enterprise, name: "The Farm") }
|
||||||
let!(:enterprise2) { create(:enterprise) }
|
let!(:enterprise2) { create(:enterprise) }
|
||||||
|
let!(:enterprise3) { create(:enterprise) }
|
||||||
|
|
||||||
let!(:customer1) {
|
let!(:customer1) {
|
||||||
create(
|
create(
|
||||||
:customer,
|
:customer,
|
||||||
@@ -74,6 +76,33 @@ describe "Customers", type: :request do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "as a user who manages the enterprise" do
|
||||||
|
let!(:user){ enterprise3.users.first }
|
||||||
|
before do
|
||||||
|
EnterpriseRole.create!(user: user, enterprise: enterprise1)
|
||||||
|
login_as user
|
||||||
|
end
|
||||||
|
|
||||||
|
it "returns customers of enterprises the user manages" do
|
||||||
|
get "/api/v1/customers"
|
||||||
|
expect(json_response_ids).to eq [customer1.id.to_s, customer2.id.to_s]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "as an enterprise that has edit profile permission" do
|
||||||
|
let!(:user){ enterprise3.users.first }
|
||||||
|
before do
|
||||||
|
EnterpriseRelationship.create!(parent: enterprise1, child: enterprise3,
|
||||||
|
permissions_list: [:edit_profile])
|
||||||
|
login_as user
|
||||||
|
end
|
||||||
|
|
||||||
|
it "shoult not return customers of the managed enterprise" do
|
||||||
|
get "/api/v1/customers"
|
||||||
|
expect(json_response_ids).to eq []
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "with ransack params searching for specific customers" do
|
context "with ransack params searching for specific customers" do
|
||||||
before { login_as enterprise2.owner }
|
before { login_as enterprise2.owner }
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ describe ImageImporter do
|
|||||||
}.by(1)
|
}.by(1)
|
||||||
|
|
||||||
expect(product.images.count).to eq 1
|
expect(product.images.count).to eq 1
|
||||||
expect(product.images.first.attachment_blob.byte_size).to eq 6274
|
expect(product.reload.images.first.attachment_blob.byte_size).to eq 6274
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,22 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'base_spec_helper'
|
require 'base_spec_helper'
|
||||||
|
|
||||||
require 'database_cleaner'
|
require 'database_cleaner'
|
||||||
require 'view_component/test_helpers'
|
|
||||||
|
|
||||||
RSpec.configure do |config|
|
RSpec.configure do |config|
|
||||||
# DatabaseCleaner
|
|
||||||
config.before(:suite) {
|
|
||||||
DatabaseCleaner.clean_with :deletion, except: ['spree_countries', 'spree_states']
|
|
||||||
}
|
|
||||||
config.before(:each) { DatabaseCleaner.strategy = :transaction }
|
|
||||||
config.before(:each, concurrency: true) {
|
|
||||||
DatabaseCleaner.strategy = :deletion, { except: ['spree_countries', 'spree_states'] }
|
|
||||||
}
|
|
||||||
config.before(:each) { DatabaseCleaner.start }
|
|
||||||
config.after(:each) { DatabaseCleaner.clean }
|
|
||||||
|
|
||||||
# Precompile Webpacker assets (once) when starting the suite. The default setup can result
|
# Precompile Webpacker assets (once) when starting the suite. The default setup can result
|
||||||
# in the assets getting compiled many times throughout the build, slowing it down.
|
# in the assets getting compiled many times throughout the build, slowing it down.
|
||||||
config.before :suite do
|
config.before :suite do
|
||||||
@@ -26,20 +13,6 @@ RSpec.configure do |config|
|
|||||||
# Fix encoding issue in Rails 5.0; allows passing empty arrays or hashes as params.
|
# Fix encoding issue in Rails 5.0; allows passing empty arrays or hashes as params.
|
||||||
config.before(:each, type: :controller) { @request.env["CONTENT_TYPE"] = 'application/json' }
|
config.before(:each, type: :controller) { @request.env["CONTENT_TYPE"] = 'application/json' }
|
||||||
|
|
||||||
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
|
||||||
# examples within a transaction, remove the following line or assign false
|
|
||||||
# instead of true.
|
|
||||||
config.use_transactional_fixtures = false
|
|
||||||
|
|
||||||
# You can use `rspec -n` to run only failed specs.
|
# You can use `rspec -n` to run only failed specs.
|
||||||
config.example_status_persistence_file_path = "tmp/rspec-status.txt"
|
config.example_status_persistence_file_path = "tmp/rspec-status.txt"
|
||||||
|
|
||||||
# Helpers
|
|
||||||
config.include ViewComponent::TestHelpers, type: :component
|
|
||||||
config.include ControllerRequestsHelper, type: :controller
|
|
||||||
config.include Devise::Test::ControllerHelpers, type: :controller
|
|
||||||
config.include OpenFoodNetwork::ApiHelper, type: :controller
|
|
||||||
config.include OpenFoodNetwork::ControllerHelper, type: :controller
|
|
||||||
config.include Features::DatepickerHelper, type: :feature
|
|
||||||
config.include DownloadsHelper, type: :feature
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,22 +4,11 @@ module AuthenticationHelper
|
|||||||
include Warden::Test::Helpers
|
include Warden::Test::Helpers
|
||||||
|
|
||||||
def login_as_admin
|
def login_as_admin
|
||||||
admin_user = create(:admin_user)
|
login_as create(:admin_user)
|
||||||
login_as admin_user
|
|
||||||
admin_user
|
|
||||||
end
|
|
||||||
|
|
||||||
def login_as_admin_and_visit(path_visit)
|
|
||||||
login_as_admin
|
|
||||||
visit path_visit
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def login_to_admin_section
|
def login_to_admin_section
|
||||||
login_as_admin_and_visit(spree.admin_dashboard_path)
|
login_as_admin
|
||||||
end
|
|
||||||
|
|
||||||
def login_to_admin_as(user)
|
|
||||||
login_as user
|
|
||||||
visit spree.admin_dashboard_path
|
visit spree.admin_dashboard_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ describe '
|
|||||||
before do
|
before do
|
||||||
order.finalize!
|
order.finalize!
|
||||||
create(:check_payment, order: order, amount: order.total)
|
create(:check_payment, order: order, amount: order.total)
|
||||||
login_as_admin_and_visit spree.admin_orders_path
|
login_as_admin
|
||||||
|
visit spree.admin_orders_path
|
||||||
end
|
end
|
||||||
|
|
||||||
it "adding taxed adjustments to an order" do
|
it "adding taxed adjustments to an order" do
|
||||||
@@ -97,7 +98,8 @@ describe '
|
|||||||
}
|
}
|
||||||
before do
|
before do
|
||||||
order.cancel!
|
order.cancel!
|
||||||
login_as_admin_and_visit spree.edit_admin_order_path(order)
|
login_as_admin
|
||||||
|
visit spree.edit_admin_order_path(order)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "displays adjustments" do
|
it "displays adjustments" do
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ describe '
|
|||||||
}
|
}
|
||||||
|
|
||||||
before :each do
|
before :each do
|
||||||
login_as_admin_and_visit spree.admin_orders_path
|
login_as_admin
|
||||||
|
visit spree.admin_orders_path
|
||||||
end
|
end
|
||||||
|
|
||||||
it "deletes orders" do
|
it "deletes orders" do
|
||||||
|
|||||||
@@ -85,13 +85,29 @@ describe '
|
|||||||
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
|
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
|
||||||
completed_at: Time.zone.now )
|
completed_at: Time.zone.now )
|
||||||
}
|
}
|
||||||
|
let!(:o3) {
|
||||||
|
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
|
||||||
|
completed_at: Time.zone.now )
|
||||||
|
}
|
||||||
|
let!(:product) {
|
||||||
|
create(:simple_product)
|
||||||
|
}
|
||||||
|
let!(:var1) {
|
||||||
|
create(:variant, product_id: product.id, display_name: "Little Fish")
|
||||||
|
}
|
||||||
|
let!(:var2) {
|
||||||
|
create(:variant, product_id: product.id, display_name: "Big Fish")
|
||||||
|
}
|
||||||
|
|
||||||
before do
|
before do
|
||||||
15.times {
|
10.times {
|
||||||
create(:line_item_with_shipment, order: o1)
|
create(:line_item_with_shipment, variant: var1, order: o2)
|
||||||
}
|
}
|
||||||
5.times {
|
5.times {
|
||||||
create(:line_item_with_shipment, order: o2)
|
create(:line_item_with_shipment, variant: var2, order: o1)
|
||||||
|
}
|
||||||
|
5.times {
|
||||||
|
create(:line_item_with_shipment, variant: var1, order: o3)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -125,6 +141,20 @@ describe '
|
|||||||
select2_select "100 per page", from: "autogen4" # should display all 20 line items
|
select2_select "100 per page", from: "autogen4" # should display all 20 line items
|
||||||
expect(page).to have_content "20 Results found. Viewing 1 to 20."
|
expect(page).to have_content "20 Results found. Viewing 1 to 20."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "clicking the product variant" do
|
||||||
|
visit_bulk_order_management
|
||||||
|
expect(page).to have_content "Little Fish", count: 10
|
||||||
|
expect(page).to have_content "Big Fish", count: 5
|
||||||
|
click_on("Little Fish") # opens BOM box
|
||||||
|
within "#listing_orders" do
|
||||||
|
expect(page).to have_content "Little Fish", count: 15
|
||||||
|
expect(page).not_to have_content "Big Fish"
|
||||||
|
end
|
||||||
|
find("a", text: "Clear").click # closes BOM box
|
||||||
|
expect(page).to have_content "Little Fish", count: 10
|
||||||
|
expect(page).to have_content "Big Fish", count: 5
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "searching" do
|
context "searching" do
|
||||||
@@ -228,7 +258,7 @@ describe '
|
|||||||
|
|
||||||
it "displays a column for user's full name" do
|
it "displays a column for user's full name" do
|
||||||
expect(page).to have_selector "th.full_name", text: "NAME"
|
expect(page).to have_selector "th.full_name", text: "NAME"
|
||||||
expect(page).to have_selector "td.full_name", text: o1.bill_address.full_name
|
expect(page).to have_selector "td.full_name", text: "#{o1.bill_address.last_name}, #{o1.bill_address.first_name}"
|
||||||
expect(page).to have_selector "td.full_name", text: ""
|
expect(page).to have_selector "td.full_name", text: ""
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -266,46 +296,69 @@ describe '
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "sorting of line items" do
|
describe "sorting of line items" do
|
||||||
let!(:o1) {
|
let!(:o1) do
|
||||||
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
|
create(
|
||||||
completed_at: Time.zone.now)
|
:order_with_distributor,
|
||||||
}
|
bill_address: create(:address, first_name: 'Bob', last_name: 'Taylor'),
|
||||||
let!(:o2) {
|
state: 'complete',
|
||||||
create(:order_with_distributor, state: 'complete', shipment_state: 'ready',
|
shipment_state: 'ready',
|
||||||
completed_at: Time.zone.now)
|
completed_at: Time.zone.now
|
||||||
}
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
let!(:o2) do
|
||||||
|
create(
|
||||||
|
:order_with_distributor,
|
||||||
|
bill_address: create(:address, first_name: 'Mary', last_name: 'Smith'),
|
||||||
|
state: 'complete',
|
||||||
|
shipment_state: 'ready',
|
||||||
|
completed_at: Time.zone.now
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
let!(:o3) do
|
||||||
|
create(
|
||||||
|
:order_with_distributor,
|
||||||
|
bill_address: create(:address, first_name: 'Bill', last_name: 'Taylor'),
|
||||||
|
state: 'complete',
|
||||||
|
shipment_state: 'ready',
|
||||||
|
completed_at: Time.zone.now
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
let!(:li1) { create(:line_item_with_shipment, order: o1) }
|
let!(:li1) { create(:line_item_with_shipment, order: o1) }
|
||||||
let!(:li2) { create(:line_item_with_shipment, order: o2) }
|
let!(:li2) { create(:line_item_with_shipment, order: o2) }
|
||||||
|
let!(:li3) { create(:line_item_with_shipment, order: o3) }
|
||||||
|
|
||||||
before :each do
|
before :each do
|
||||||
visit_bulk_order_management
|
visit_bulk_order_management
|
||||||
end
|
end
|
||||||
|
|
||||||
it "sorts by customer name when the customer name header is clicked" do
|
it "sorts by customer last name when the customer name header is clicked" do
|
||||||
customer_names = [o1.name, o2.name].sort
|
|
||||||
|
|
||||||
within "#listing_orders thead" do
|
within "#listing_orders thead" do
|
||||||
click_on "Name"
|
click_on "Name"
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_selector("#listing_orders .line_item:nth-child(1) .full_name",
|
expect(page).to have_selector("#listing_orders .line_item:nth-child(1) .full_name",
|
||||||
text: customer_names[0])
|
text: "Smith, Mary")
|
||||||
expect(page).to have_selector("#listing_orders .line_item:nth-child(2) .full_name",
|
expect(page).to have_selector("#listing_orders .line_item:nth-child(2) .full_name",
|
||||||
text: customer_names[1])
|
text: "Taylor, Bill")
|
||||||
|
expect(page).to have_selector("#listing_orders .line_item:nth-child(3) .full_name",
|
||||||
|
text: "Taylor, Bob")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "sorts by customer name in reverse when the customer name header is clicked twice" do
|
it "sorts by customer last name in reverse when the customer name header is clicked twice" do
|
||||||
customer_names = [o1.name, o2.name].sort.reverse
|
|
||||||
|
|
||||||
within "#listing_orders thead" do
|
within "#listing_orders thead" do
|
||||||
click_on "Name"
|
click_on "Name"
|
||||||
click_on "Name"
|
click_on "Name"
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_selector("#listing_orders .line_item:nth-child(1) .full_name",
|
expect(page).to have_selector("#listing_orders .line_item:nth-child(1) .full_name",
|
||||||
text: customer_names[1])
|
text: "Taylor, Bob")
|
||||||
expect(page).to have_selector("#listing_orders .line_item:nth-child(2) .full_name",
|
expect(page).to have_selector("#listing_orders .line_item:nth-child(2) .full_name",
|
||||||
text: customer_names[0])
|
text: "Taylor, Bill")
|
||||||
|
expect(page).to have_selector("#listing_orders .line_item:nth-child(3) .full_name",
|
||||||
|
text: "Smith, Mary")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1024,34 +1077,39 @@ describe '
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "displays group buy calc box" do
|
shared_examples "display only group by information for selected variant" do
|
||||||
expect(page).to have_selector "div#group_buy_calculation"
|
it "displays group buy calc box" do
|
||||||
|
expect(page).to have_selector "div#group_buy_calculation"
|
||||||
|
|
||||||
within "div#group_buy_calculation" do
|
within "div#group_buy_calculation" do
|
||||||
expect(page).to have_text "Group Buy Unit Size"
|
expect(page).to have_text "Group Buy Unit Size"
|
||||||
expect(page).to have_text "5000 g"
|
expect(page).to have_text "5000 g"
|
||||||
expect(page).to have_text "Total Quantity Ordered"
|
expect(page).to have_text "Total Quantity Ordered"
|
||||||
expect(page).to have_text "4000 g"
|
expect(page).to have_text "4000 g"
|
||||||
expect(page).to have_text "Max Quantity Ordered"
|
expect(page).to have_text "Max Quantity Ordered"
|
||||||
expect(page).to have_text "9000 g"
|
expect(page).to have_text "9000 g"
|
||||||
expect(page).to have_text "Current Fulfilled Units"
|
expect(page).to have_text "Current Fulfilled Units"
|
||||||
expect(page).to have_text "0.8"
|
expect(page).to have_text "0.8"
|
||||||
expect(page).to have_text "Max Fulfilled Units"
|
expect(page).to have_text "Max Fulfilled Units"
|
||||||
expect(page).to have_text "1.8"
|
expect(page).to have_text "1.8"
|
||||||
expect(page).to have_selector "div.shared_resource"
|
expect(page).to have_selector "div.shared_resource"
|
||||||
within "div.shared_resource" do
|
within "div.shared_resource" do
|
||||||
expect(page).to have_selector "span", text: "Shared Resource?"
|
expect(page).to have_selector "span", text: "Shared Resource?"
|
||||||
expect(page).to have_selector "input#shared_resource"
|
expect(page).to have_selector "input#shared_resource"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "all line items of the same variant" do
|
||||||
|
expect(page).to have_no_selector "tr#li_#{li1.id}"
|
||||||
|
expect(page).to have_no_selector "tr#li_#{li2.id}"
|
||||||
|
expect(page).to have_selector "tr#li_#{li3.id}"
|
||||||
|
expect(page).to have_selector "tr#li_#{li4.id}"
|
||||||
|
expect(page).to have_css("table#listing_orders tbody tr", count: 2)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "all line items of the same variant" do
|
it_behaves_like "display only group by information for selected variant"
|
||||||
expect(page).to have_no_selector "tr#li_#{li1.id}"
|
|
||||||
expect(page).to have_no_selector "tr#li_#{li2.id}"
|
|
||||||
expect(page).to have_selector "tr#li_#{li3.id}"
|
|
||||||
expect(page).to have_selector "tr#li_#{li4.id}"
|
|
||||||
end
|
|
||||||
|
|
||||||
context "clicking 'Clear' in group buy box" do
|
context "clicking 'Clear' in group buy box" do
|
||||||
before :each do
|
before :each do
|
||||||
@@ -1064,6 +1122,32 @@ describe '
|
|||||||
expect(page).to have_selector "tr#li_#{li2.id}"
|
expect(page).to have_selector "tr#li_#{li2.id}"
|
||||||
expect(page).to have_selector "tr#li_#{li3.id}"
|
expect(page).to have_selector "tr#li_#{li3.id}"
|
||||||
expect(page).to have_selector "tr#li_#{li4.id}"
|
expect(page).to have_selector "tr#li_#{li4.id}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when filtering" do
|
||||||
|
before do
|
||||||
|
fill_in "quick_filter", with: li3.order.email
|
||||||
|
page.find('.filter-actions .button.icon-search').click
|
||||||
|
end
|
||||||
|
|
||||||
|
it "shows only variant filtering by email" do
|
||||||
|
expect(page).to have_no_selector "tr#li_#{li1.id}"
|
||||||
|
expect(page).to have_no_selector "tr#li_#{li2.id}"
|
||||||
|
expect(page).to have_selector "tr#li_#{li3.id}"
|
||||||
|
expect(page).to have_no_selector "tr#li_#{li4.id}"
|
||||||
|
end
|
||||||
|
|
||||||
|
context "clicking 'Clear Filters' button" do
|
||||||
|
before :each do
|
||||||
|
page.find('.filter-actions #clear_filters_button').click
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like "display only group by information for selected variant"
|
||||||
|
|
||||||
|
it "but actually clears the filters" do
|
||||||
|
expect(page.find("input[name='quick_filter']").value).to eq("")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -208,7 +208,8 @@ describe '
|
|||||||
shipping_category = create(:shipping_category)
|
shipping_category = create(:shipping_category)
|
||||||
taxon = create(:taxon)
|
taxon = create(:taxon)
|
||||||
|
|
||||||
login_as_admin_and_visit spree.admin_products_path
|
login_as_admin
|
||||||
|
visit spree.admin_products_path
|
||||||
|
|
||||||
find("a", text: "NEW PRODUCT").click
|
find("a", text: "NEW PRODUCT").click
|
||||||
expect(page).to have_content 'NEW PRODUCT'
|
expect(page).to have_content 'NEW PRODUCT'
|
||||||
@@ -528,7 +529,8 @@ describe '
|
|||||||
p1 = FactoryBot.create(:simple_product, name: "product1", supplier: s1)
|
p1 = FactoryBot.create(:simple_product, name: "product1", supplier: s1)
|
||||||
p2 = FactoryBot.create(:simple_product, name: "product2", supplier: s2)
|
p2 = FactoryBot.create(:simple_product, name: "product2", supplier: s2)
|
||||||
|
|
||||||
login_as_admin_and_visit spree.admin_products_path
|
login_as_admin
|
||||||
|
visit spree.admin_products_path
|
||||||
|
|
||||||
select2_select s1.name, from: "producer_filter"
|
select2_select s1.name, from: "producer_filter"
|
||||||
apply_filters
|
apply_filters
|
||||||
@@ -605,7 +607,8 @@ describe '
|
|||||||
let!(:v2) { p2.variants.first }
|
let!(:v2) { p2.variants.first }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
login_as_admin_and_visit spree.admin_products_path
|
login_as_admin
|
||||||
|
visit spree.admin_products_path
|
||||||
end
|
end
|
||||||
|
|
||||||
it "shows an edit button for products, which takes the user to the standard edit page for that product" do
|
it "shows an edit button for products, which takes the user to the standard edit page for that product" do
|
||||||
@@ -678,7 +681,8 @@ describe '
|
|||||||
p2 = FactoryBot.create(:product, name: "P2")
|
p2 = FactoryBot.create(:product, name: "P2")
|
||||||
p3 = FactoryBot.create(:product, name: "P3")
|
p3 = FactoryBot.create(:product, name: "P3")
|
||||||
|
|
||||||
login_as_admin_and_visit spree.admin_products_path
|
login_as_admin
|
||||||
|
visit spree.admin_products_path
|
||||||
|
|
||||||
expect(page).to have_selector "a.clone-product", count: 3
|
expect(page).to have_selector "a.clone-product", count: 3
|
||||||
|
|
||||||
@@ -702,7 +706,8 @@ describe '
|
|||||||
describe "using column display dropdown" do
|
describe "using column display dropdown" do
|
||||||
it "shows a column display dropdown, which shows a list of columns when clicked" do
|
it "shows a column display dropdown, which shows a list of columns when clicked" do
|
||||||
FactoryBot.create(:simple_product)
|
FactoryBot.create(:simple_product)
|
||||||
login_as_admin_and_visit spree.admin_products_path
|
login_as_admin
|
||||||
|
visit spree.admin_products_path
|
||||||
|
|
||||||
toggle_columns "Available On"
|
toggle_columns "Available On"
|
||||||
|
|
||||||
@@ -729,7 +734,8 @@ describe '
|
|||||||
p1 = FactoryBot.create(:simple_product, name: "product1", supplier: s1)
|
p1 = FactoryBot.create(:simple_product, name: "product1", supplier: s1)
|
||||||
p2 = FactoryBot.create(:simple_product, name: "product2", supplier: s2)
|
p2 = FactoryBot.create(:simple_product, name: "product2", supplier: s2)
|
||||||
|
|
||||||
login_as_admin_and_visit spree.admin_products_path
|
login_as_admin
|
||||||
|
visit spree.admin_products_path
|
||||||
|
|
||||||
# Page shows the filter controls
|
# Page shows the filter controls
|
||||||
expect(page).to have_select "producer_filter", visible: false
|
expect(page).to have_select "producer_filter", visible: false
|
||||||
@@ -785,7 +791,7 @@ describe '
|
|||||||
@enterprise_user.enterprise_roles.build(enterprise: supplier_managed2).save
|
@enterprise_user.enterprise_roles.build(enterprise: supplier_managed2).save
|
||||||
@enterprise_user.enterprise_roles.build(enterprise: distributor_managed).save
|
@enterprise_user.enterprise_roles.build(enterprise: distributor_managed).save
|
||||||
|
|
||||||
login_to_admin_as @enterprise_user
|
login_as @enterprise_user
|
||||||
end
|
end
|
||||||
|
|
||||||
it "shows only products that I supply" do
|
it "shows only products that I supply" do
|
||||||
@@ -888,7 +894,8 @@ describe '
|
|||||||
let!(:product) { create(:simple_product, name: "Carrots") }
|
let!(:product) { create(:simple_product, name: "Carrots") }
|
||||||
|
|
||||||
it "displays product images and image upload modal" do
|
it "displays product images and image upload modal" do
|
||||||
login_as_admin_and_visit spree.admin_products_path
|
login_as_admin
|
||||||
|
visit spree.admin_products_path
|
||||||
|
|
||||||
within "table#listing_products tr#p_#{product.id}" do
|
within "table#listing_products tr#p_#{product.id}" do
|
||||||
# Displays product images
|
# Displays product images
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ describe "
|
|||||||
include WebHelper
|
include WebHelper
|
||||||
|
|
||||||
before do
|
before do
|
||||||
login_as_admin_and_visit spree.edit_admin_general_settings_path
|
login_as_admin
|
||||||
|
visit spree.edit_admin_general_settings_path
|
||||||
click_link "Content"
|
click_link "Content"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ describe "General Settings" do
|
|||||||
include AuthenticationHelper
|
include AuthenticationHelper
|
||||||
|
|
||||||
before do
|
before do
|
||||||
login_as_admin_and_visit spree.admin_dashboard_path
|
login_as_admin
|
||||||
|
visit spree.admin_dashboard_path
|
||||||
click_link "Configuration"
|
click_link "Configuration"
|
||||||
click_link "General Settings"
|
click_link "General Settings"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,7 +5,10 @@ require 'system_helper'
|
|||||||
describe "Mail Methods" do
|
describe "Mail Methods" do
|
||||||
include AuthenticationHelper
|
include AuthenticationHelper
|
||||||
|
|
||||||
before { login_as_admin_and_visit spree.edit_admin_general_settings_path }
|
before do
|
||||||
|
login_as_admin
|
||||||
|
visit spree.edit_admin_general_settings_path
|
||||||
|
end
|
||||||
|
|
||||||
context "edit" do
|
context "edit" do
|
||||||
before { click_link "Mail Method Settings" }
|
before { click_link "Mail Method Settings" }
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ describe "Shipping Categories" do
|
|||||||
|
|
||||||
context 'user adds a new shipping category with temperature control' do
|
context 'user adds a new shipping category with temperature control' do
|
||||||
it 'user sees new shipping category with temperature control' do
|
it 'user sees new shipping category with temperature control' do
|
||||||
login_as_admin_and_visit spree.admin_shipping_categories_path
|
login_as_admin
|
||||||
|
visit spree.admin_shipping_categories_path
|
||||||
click_link "New Shipping Category"
|
click_link "New Shipping Category"
|
||||||
|
|
||||||
fill_in "shipping_category_name", with: "freeze"
|
fill_in "shipping_category_name", with: "freeze"
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ describe "Tax Categories" do
|
|||||||
include WebHelper
|
include WebHelper
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
login_as_admin_and_visit spree.edit_admin_general_settings_path
|
login_as_admin
|
||||||
|
visit spree.edit_admin_general_settings_path
|
||||||
end
|
end
|
||||||
|
|
||||||
context "admin visiting tax categories list" do
|
context "admin visiting tax categories list" do
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user