Matt-Yorkley
28bf71e77e
Fix N+1 in CachedEnterpriseSerializer
2021-08-16 14:58:52 +01:00
Andy Brett
46cd05c54a
Merge pull request #7712 from guidoDutra/1861-enable-shopfront-sorting-by-producer
...
Enable sorting by producer in shopfront
2021-07-06 09:27:42 -07:00
Pau Pérez Fabregat
db993652c4
Merge branch 'master' into payment-states
2021-06-18 12:20:26 +02:00
Luis Ramos
e52937c113
Use rubocop auto correct to add frozen string literal to all files
...
This is an unsafe auto corection, we will need to trust our build here
2021-06-17 23:07:26 +01:00
Andy Brett
31738ceb49
rename and consolidate authorization? methods
2021-06-17 14:23:59 -07:00
Luis Ramos
23627c5453
Run rubocop -a (safe corrections) removing all exceptions so all possible fixes are applied
...
9290 issues fixed
2021-06-17 22:19:26 +01:00
Guido Oliveira
c5471fc25c
enable ordering shopfront by producer id
2021-06-16 15:02:27 -03:00
Pau Perez
dfe83e5c51
Do not return master variant in api/ocs/products
...
`product.master` seems to always be `null` on
/api/v0/order_cycles/:id/products JSON response. That's because the
first of the underlying AR relation,
`order_cycle.variants_distributed_by(distributor)`, does not include
master variants. They are not in OC exchanges.
2021-06-04 12:10:52 +02:00
Pau Perez
e7166ba5d4
Drop product.price from /api/ocs/:id/products
...
Its serializer it's only used by this endpoint and
app/assets/javascripts/templates/shop_variant.html.haml doesn't rely on
the response's product.price but the variant's price.
Because our DB schema allows NULL on spree_prices.amount, a master
variant without a price can cause the shopfront not to load products.
This was the case in
https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/60adfcc31cf9740007f82fc9 .
2021-06-04 12:10:52 +02:00
Pau Pérez Fabregat
8c81c14c8d
Merge pull request #7580 from apricot12/Remove-LineItems-N+1
...
Removed N+1 queries while counting line_items
2021-05-20 11:42:14 +02:00
Nihal Mohammed
fcf70c242e
edit item_count method to shorthand for improved readability
2021-05-09 18:31:26 +05:30
Nihal Mohammed
e485a4a8ef
Remove untested change to payments
2021-05-08 23:51:38 +05:30
Nihal Mohammed
026942dd72
Fix item_count to properly count quantity of every item
2021-05-08 23:45:41 +05:30
Nihal Mohammed
237ebd6ec4
Removed N+1 queries while counting line_items
2021-05-08 21:09:06 +05:30
Guido Oliveira
84285ff985
prevent deleting only item in confirmed order
2021-04-28 17:37:28 -03:00
Jean-Baptiste Bellet
ddb63dff8a
Add name of the customers into subscriptions table
...
- Thus, we can filter subscriptions by customer email
2021-04-20 16:09:48 +02:00
Pau Perez
5bca7d1f8f
Remove the old balance's code branch
...
This keeps the `OrderBalance` abstraction but removes the old code now
that the feature is enabled for all users in all instances and there are
no bugs reported. It's become dead code.
2021-04-19 11:52:41 +02:00
Matt-Yorkley
b6038c01a3
Remove references to Adjustment source
2021-04-14 12:01:21 +01:00
Matt-Yorkley
80d43c714d
Remove TagRule::DiscountOrder
...
This class was removed from the UI in 2016 and hasn't been used since...
2021-04-08 12:37:17 +01:00
Matt-Yorkley
74ba6e35be
Merge pull request #7283 from Matt-Yorkley/unit-price-nils
...
Defend against nils in variant serializer
2021-03-30 17:00:26 +02:00
Pau Pérez Fabregat
7d5726b6c7
Merge pull request #7150 from coopdevs/use-order-balance-object
...
Feature-toggle all remaining parts of the app where the order balance is shown
2021-03-30 15:58:12 +02:00
Matt-Yorkley
741dee29c3
Defend against nils in variant serializer
...
If unit_price.denominator ever returns nil, the serializer won't explode now.
2021-03-30 14:45:33 +01:00
Andy Brett
691dd05028
Merge pull request #6956 from andrewpbrett/unit-price-backend
...
Provide actual unit price values in front end shop
2021-03-25 12:50:59 -07:00
Andy Brett
7319ef7345
use better method and class names
2021-03-25 08:51:15 -07:00
Andy Brett
89c7342892
memoize UnitPrices object
2021-03-25 08:51:15 -07:00
Andy Brett
39fc0707c3
provide unit price values in front end shop
2021-03-25 08:51:15 -07:00
Matt-Yorkley
a0e6b64e98
Update Order serializer
2021-03-23 18:17:50 +00:00
Pau Perez
9762275555
Use old_outstanding_balance on disabled toggle
...
No need to go through the `OrderBalance` in this context since we
already check for the toggle.
2021-03-22 11:45:12 +01:00
Matt-Yorkley
ff58e2da54
Use AR syntax in queries
2021-03-04 14:27:02 +00:00
Matt-Yorkley
045cdec23c
Update OrderDetailedSerializer
2021-03-04 14:27:02 +00:00
Pau Pérez Fabregat
404ec7bf92
Merge pull request #6950 from andrewpbrett/fix-nil-enterprise-category
...
Fix #6949 : Add default icon value if enterprise.category is nil
2021-02-25 13:20:10 +01:00
Andy Brett
bc7477795c
Merge pull request #6910 from andrewpbrett/remove-order-capture
...
Make orders not capturable if they have a payment pending authorization
2021-02-24 12:20:43 -08:00
Pau Perez
ec3b402856
Remove dead serializer
...
This became unused in
b9d72ce4cf (diff-5df9d1d16b9e9ac1724af5c6180ca86f7caeb6a4880d2f77ac25fbe757b597b9) .
2021-02-24 17:09:16 +01:00
Andy Brett
2d304bd997
add default icon value if enterprise.category is nil
2021-02-23 11:37:36 -08:00
Pau Perez
20a7f2f24e
Eager load payment and subs. order associations
...
This removes the N+1 queries caused by
`Api::Admin::OrderSerialier#ready_to_capture` when used from
`Api::OrdersController#index`. While it's fine for the single-order
controller actions, it's not for this one that deals with a collection
of orders.
Fortunately, `SearchOrders` is used only in this controller action so we
can put the `includes` calls there, otherwise, we would need to refactor
it a bit to pass in a context-specific AR relation.
2021-02-23 10:26:12 -08:00
Andy Brett
d62a984939
make orders not capturable if they have a payment pending authorization
2021-02-23 10:26:04 -08:00
Andy Brett
ff243c40a7
Merge pull request #6885 from andrewpbrett/fix-group-map-icons
...
Move map icons to /public
2021-02-22 08:11:54 -08:00
Andy Brett
05736884fe
prepend / to route
2021-02-19 07:43:29 -08:00
Andy Brett
e7489965c5
move map icons to public/
2021-02-19 07:43:23 -08:00
Andy Brett
f463af327c
Merge pull request #6808 from andrewpbrett/authorize-payment-links
...
Allow a customer to perform further action for a Stripe payment if needed (#4181 )
2021-02-17 10:17:51 -08:00
Jean-Baptiste Bellet
8c42388af1
add a randomized unit price for variant
...
unit price is composed with :
- a unit_price_price which is a number that can be localized (depending on the currency)
- a unit_price_unit which can be either `item` of `kg`
@andrewpbrett will do stuff to have a relevant unit price for each variant
2021-02-16 15:26:21 +01:00
Andy Brett
f8239ed3ed
use image path generator for map icons
2021-02-15 14:43:34 -08:00
Andy Brett
8c7bf863f8
return pending payments in order serializer
2021-02-12 12:20:35 -08:00
Andy Brett
6efad74c5c
add authorize link to transactions page
2021-02-12 12:20:35 -08:00
Pau Pérez Fabregat
2668747237
Merge pull request #6723 from luisramos0/spree_routes_2
...
Move spree orders routes out of the spree engine routes into the main app routes
2021-01-28 16:31:49 +01:00
Luis Ramos
f3da7afd55
Replace spree_order_path with order_path so we can use scope in the routes file
2021-01-25 19:55:42 +00:00
Luis Ramos
21f48b52c8
Fix cancel order route
2021-01-25 19:52:48 +00:00
Luis Ramos
88c21ef82e
Fix order path
2021-01-25 19:52:48 +00:00
Pau Perez
20abaaa950
Reuse outstanding balance statement across queries
...
Instead of relying on Spree::Order#outstanding_balance we make us of the
result set `balance_value` computed column. So, we ask PostgreSQL to
compute it instead of Ruby and then serialize it from that computed
column. That's a bit faster to compute that way and let's reuse logic.
We hide this new implementation under this features' toggle so it's only
used when enabled. We want hit the old behaviour by default.
2021-01-20 18:23:22 +01:00
Andy Brett
18dcbbd892
Merge pull request #6613 from Matt-Yorkley/variant-override-serialization
...
Don't serialize all variant override objects where they are not needed
2021-01-14 10:59:11 -08:00