Luis Ramos
a6a695660f
Merge pull request #4002 from luisramos0/more_rails4
...
Adapting queries in permissions to Rails 4
2019-07-19 15:17:01 +01:00
Pau Perez
f42bf72b32
Fix rubocop violations
...
It's not affordable to fix the failed Metrics cops in the scope of this
bug fix, but now, with a separate class, it'll be easier.
2019-07-05 18:19:58 +02:00
Pau Perez
9b03833df0
Extract orders & fulfillments default report clasts
2019-07-05 18:19:58 +02:00
Pau Perez
fada30435f
DRY some procs from report
2019-07-05 18:19:58 +02:00
luisramos0
a5b5e5de32
Remove trailing backslash
2019-07-05 10:58:53 +01:00
Pau Perez
db7b7bbde2
Fix finding supplier for a deleted product
2019-07-04 18:52:56 +02:00
luisramos0
ef61310bad
Fix long lines in order_cycle_permissions and permissions
2019-07-04 17:17:58 +01:00
Pau Perez
ee301c5e2f
Address Code Climate (rubocop) issues
2019-07-04 17:01:06 +02:00
Pau Perez
4d060815d0
Extract unscoping logic into method
...
DRYies out the code a bit.
2019-07-04 17:01:06 +02:00
Pau Perez
f91bd03c25
Add clarifying comment to report
2019-07-04 17:01:06 +02:00
Pau Perez
7de4ec2a90
Fix orders and fulfillments report
...
It bypasses the default_scope to retrieve deleted variants in the orders
and fulfillment report.
2019-07-04 17:01:06 +02:00
Pau Perez
812d8cac4a
Make complex method a bit more readable
2019-07-04 17:01:06 +02:00
luisramos0
dee1c3d139
Fix typo in order_cycle_permissions.rb
2019-07-03 22:58:33 +01:00
luisramos0
bb9c54a445
Use enterprises.id instead of :id to remove ambiguous column errors
2019-07-03 22:03:40 +01:00
luisramos0
e5f396f975
Fix Permissions.related_enterprises_granted by adding explicit reference to table
2019-07-03 20:18:01 +01:00
luisramos0
a57a93d414
Adapt permissions.rb and order_cycle_permissions to rails 4
2019-07-03 20:18:01 +01:00
luisramos0
a82b1d8129
Adapt exchange.involving scope to rails 4
2019-07-03 20:18:00 +01:00
luisramos0
5184fa540c
Adapt enterprise_relationship permitting and permitted_by scopes to rails 4
2019-07-03 20:18:00 +01:00
Luis Ramos
951787d456
Merge pull request #3987 from mkllnk/3978-optimise-products-cache
...
3978 Optimise products cache
2019-07-03 19:59:07 +01:00
Maikel Linke
04b07a1ff5
Further optimise querying affected exchanges
...
The implementation queried the database for each incoming variant that
was changed. This rewrite combines ActiveRecord relations so that it
creates only one query. This saves another 5-10% of execution time when
updating enterprise fees on production instances.
2019-07-02 18:42:01 +10:00
Maikel Linke
0da7c93bc6
Collect affected exchanges more efficiently
...
When an incoming exchange of an order cycle changes, the ProductsCache
queries all affected outgoing exchanges to update them. It was creating
a big collection of exchanges with duplicates and then calling `uniq`.
That call was hitting a custom implementation of `eql?` which is very
inefficient. And since `Exchange.eql?` is ignoring the order cycle id,
it was probably filtering too many exchanges from the collection.
Fixed bug: If two order cycles sell exactly the same variants to the
same shop, the two outgoing exchanges are seen as equal. When the
variants change, ProductsCache would only update one of those two
exchanges, leaving one order cycle out of sync. This case is very rare.
It only happens if there is a shop with two active order cycles selling
exactly the same.
The new uniqueness test looks only at the attributes that are later used
to refresh the cache. I measured a page speed improvement from 90
seconds to 3 seconds (30 times faster).
2019-07-02 18:29:50 +10:00
Maikel Linke
bfe41d4cbc
Extract method to simplify
2019-07-02 18:29:50 +10:00
Maikel Linke
3e6e0b73ee
Style products cache
...
The `private` modifier doesn't affect class methods. Class methods have
to be declared as private separately. Also using more guard clauses,
brackets and linebreaks.
2019-07-02 18:29:49 +10:00
Maikel Linke
5d3dbca9c3
Toggle features via env instead of initializer
...
A FeatureToggle could be switched via a class_eval in an initializer.
The initializer was installed via ofn-install. We want to get rid of
custom, untracked initializers. Here I'm changing the FeatureToggle
class to use environment variables instead.
This change needs to be followed up with a change in ofn-install to use
the new environment variable. It affects only Australian production.
2019-06-26 11:43:22 +10:00
Maikel
5b0c8bbaef
Merge pull request #3836 from Matt-Yorkley/fast_and_furious2
...
Improve /shops, /producers, and /groups performance
2019-06-21 15:02:19 +10:00
luisramos0
b025df1798
Fix a few more rubocop issues
2019-06-18 10:52:56 +01:00
luisramos0
ba91abd20e
Adapt exchanges.with_any_variant scope to rails 4
2019-06-18 10:40:49 +01:00
Luis Ramos
91401446a5
Merge pull request #3915 from mkllnk/3844-permalink-conflicts
...
Consider deleted products when creating permalinks
2019-06-14 13:20:35 +01:00
Matt-Yorkley
45d65baf8e
Improve shops performance
2019-06-12 09:47:01 +01:00
Maikel Linke
a10bb5acbd
Consider deleted products when creating permalinks
...
https://github.com/openfoodfoundation/openfoodnetwork/issues/3844
Spree's implementation and our implementation to create a unique
permalink failed to notice conflicts with soft-deleted products. This
patch looks at deleted products as well.
2019-06-11 18:20:41 +10:00
Kristina Lim
75fdfb3c6a
Remove some usage of guard clauses for OC update
2019-05-28 21:32:25 +08:00
Kristina Lim
56a2347ea0
Extract removal of unauthorized OC exchange attributes to method
2019-05-28 21:29:20 +08:00
Kristina Lim
ea8d189d6c
Bulk update OC variant changes in OC form
2019-05-28 21:27:43 +08:00
luisramos0
86b0d71c7e
Result of rubocop auto-correct and rebuilding rubocop_manual_todo
2019-05-28 12:57:29 +01:00
Drumstickx
414ae58cbd
Rubocop changes.
2019-05-21 16:48:02 +02:00
Drumstickx
c162654757
Reduce code duplication.
2019-05-21 16:46:40 +02:00
Drumstickx
29f68ed5d8
Rubocop changes.
2019-05-21 14:51:52 +02:00
Drumstickx
2f83d02168
Reduce code duplication.
2019-05-19 22:36:55 +02:00
Drumstickx
0e6a576e33
Fix user_id IS NOT NULL check.
2019-05-19 22:05:34 +02:00
Drumstickx
4204943a7c
Styling.
2019-05-19 22:04:44 +02:00
Drumstickx
1246c3b6b9
Styling.
2019-05-19 18:57:09 +02:00
Drumstickx
ec2db4dd2a
Fixed sql injection vulnerability in users_and_enterprises_report.
2019-05-19 17:58:57 +02:00
luisramos0
44b0592223
Move OrdercycleDistributedVariants from lib/open_food_network to app/services
2019-04-11 21:37:08 +01:00
luisramos0
96ee527f0c
Rename distribution_change_validator to order_cycle_distributed_variants
2019-04-11 21:14:01 +01:00
luisramos0
ecc60f3b61
Merge branch 'master' into 2-0-stable-Mar29
2019-04-05 15:47:46 +01:00
luisramos0
527cfc1601
Merge branch 'master' into 2-0-stable-Mar29
2019-03-29 13:48:49 +00:00
sdbowen
0f7ef2671f
Add shipping method name to orders detail report
...
Added column allows users to see the shipping method of each order.
2019-03-28 16:08:10 -06:00
Kristina Lim
807cdb4746
Code style changes for Customer Totals report
2019-03-25 07:46:32 +08:00
Kristina Lim
4a95578db2
Use name helpers in Customer Totals report
2019-03-25 07:46:31 +08:00
Kristina Lim
7c7d61fbc5
Simplify some logic for Customer Totals report
...
Line items belong to a single order.
2019-03-25 07:46:30 +08:00