Luis Ramos
fd0bba19a7
Adapt enterprises code and specs to new namespace Sets::EnterpriseSet
2021-01-14 09:41:07 +00:00
Luis Ramos
ed0441dc41
Fix a few more rubocop issues
2021-01-14 09:41:07 +00:00
Luis Ramos
5d6d7f7ad0
Adapt enterprise fees code and specs to new namespace of Sets::EnterpriseFeeSet
2021-01-14 09:41:07 +00:00
Luis Ramos
96a351ad0e
Adapt usage of Sets to their new location
2021-01-14 09:41:07 +00:00
Pau Pérez Fabregat
9db4f9be15
Merge pull request #6634 from Matt-Yorkley/jobs-cleanup
...
Jobs cleanup
2021-01-14 10:08:15 +01:00
Pau Perez
398467e7ed
Hide new balance impl. under feature toggle
...
This makes it possible to deploy it without releasing it to users since
the toggle is not enabled for anyone.
It aims to make the balance calculation consistent across pages.
2021-01-11 15:50:19 +01:00
Pau Perez
2e9bae0ea5
Move relation includes out of query object
...
This query object is meant to be reusable but those includes are
context-specific and will likely not be needed when reusing the query
elsewhere. If we keep them there, chances are next dev might not notice
it and will introduce a performance regression.
2021-01-11 15:50:19 +01:00
Pau Perez
96a91969c9
Extract balance-specific serializer
...
So we only show the customer balance where really needed. Aggregating
the balance can be costly. Also, we avoid defensive coding.
2021-01-11 15:50:19 +01:00
Pau Perez
e404225de0
Extract query object
2021-01-11 15:50:19 +01:00
Pau Perez
d62ab06504
Refactor DB query to aggregate customer balance
...
It's simpler and many orders of magnitude more efficient to ask the DB
to aggregate the customer balance based on their orders. It removes
a nasty N+1.
The resulting SQL query is:
```sql
SELECT customers.*, SUM(spree_orders.total - spree_orders.payment_total) AS balance
FROM "customers"
INNER JOIN "spree_orders"
ON "spree_orders"."customer_id" = "customers"."id"
WHERE "customers"."enterprise_id" = 1
AND (completed_at IS NOT NULL)
AND (state != 'canceled')
GROUP BY customers.id
ORDER BY email;
```
2021-01-11 15:50:19 +01:00
Matt-Yorkley
dd5a197fb3
Remove ManagerInvitationJob
2021-01-09 11:56:27 +00:00
Matt-Yorkley
496f2dab69
Ensure Jobs are instantiated correctly
...
We should not be using `Delayed::Job.enqueue` anywhere...
2021-01-08 23:18:55 +00:00
Matt-Yorkley
fe0a0395d8
Remove DEFAULT_PAGE constants
2021-01-05 19:07:46 +00:00
Matt-Yorkley
47f9a3f08a
Add guard clause and remove conditionals
...
Sometimes the objects are not paginated. In this case we need to avoid trying to render pagination data, as it will throw an error. This guard clause also means we can remove messy conditionals from several controllers.
2021-01-05 18:51:24 +00:00
Paulo Vilarinho
81c3c1cf32
remove default page
2021-01-05 11:57:54 -03:00
Paulo Vilarinho
ab586f58b1
apply pagination data concern to bulk line items controller
2021-01-04 20:22:58 -03:00
Luis Ramos
0f27f57cbb
Use new Admin::ResourceController
2020-12-03 15:32:20 -08:00
Luis Ramos
1d327a61a6
Fix rubocop issue and adapt rubocop exceptions
2020-12-03 15:32:20 -08:00
Luis Ramos
0fb9f44dda
Make all controllers use new Admin::ResourceController
2020-12-03 15:32:20 -08:00
Luis Ramos
c63d99dd20
Remove Spree namespace from controller
2020-12-03 15:32:20 -08:00
Luis Ramos
99fd99cd33
Move spree admin resource controller to admin resource controller
2020-12-03 15:32:20 -08:00
Luis Ramos
1d075bbc90
Remove empty resource controller
2020-12-03 15:32:20 -08:00
Luis Ramos
6e08fccbbe
Merge resource_controller url helpers with parent version
2020-12-03 15:32:20 -08:00
Luis Ramos
fc4cf6a9a7
Merge resource_controller model_class method with parent version
2020-12-03 15:32:20 -08:00
Matt-Yorkley
aaf7a90f8b
Convert OrderCycleNotificationJob to ActiveJob
2020-11-27 14:00:29 +00:00
Matt-Yorkley
54a4952dc5
Fix ForbiddenAttributesError on tag rules
2020-11-27 14:00:28 +00:00
Matt-Yorkley
34bfd877cc
Fix #bulk_update in EnterprisesController
2020-11-27 14:00:28 +00:00
Luis Ramos
ff8d935699
Fix problem in enterprises controller
2020-11-27 13:59:46 +00:00
Matt-Yorkley
3bfa903912
Revert "Move Spree::Admin::BaseController to Admin::BaseController"
2020-11-27 14:11:57 +01:00
Andy Brett
85d99f3bf2
Merge branch 'master' into controllers
2020-11-20 08:12:03 -08:00
Matt-Yorkley
d225294b6b
Extract to PermittedAttributes::Calculator
2020-11-17 18:51:48 +00:00
Matt-Yorkley
3547b9fe56
Add missing calculator params
2020-11-17 18:51:48 +00:00
Matt-Yorkley
787f29105c
Fix ForbiddenAttribute errors for bulk update of enterprise fees and order cycles
...
Example error:
As an administrator
I want to manage simple order cycles
updating many order cycle opening/closing times at once
Failure/Error: raise ActiveModel::ForbiddenAttributesError, params.to_s
ActiveModel::ForbiddenAttributesError:
{"order_cycle_set"=>{"collection_attributes"=>{"0"=>{"id"=>62, "name"=>"Updated Order Cycle 1", "orders_open_at"=>"2040-12-01 12:00:00", "orders_close_at"=>"2040-12-01 12:00:01"}, "1"=>{"id"=>63, "name"=>"Updated Order Cycle 2", "orders_open_at"=>"2040-12-01 12:00:02", "orders_close_at"=>"2040-12-01 12:00:03"}, "2"=>{"id"=>64, "name"=>"Updated Order Cycle 3", "orders_open_at"=>"2040-12-01 12:00:04", "orders_close_at"=>"2040-12-01 12:00:05"}}}, "controller"=>"admin/order_cycles", "action"=>"bulk_update", "format"=>"json", "order_cycle"=>{}}
# ./app/controllers/application_controller.rb:20:in `print_params'
# ./lib/open_food_network/rack_request_blocker.rb:36:in `call'
# ------------------
# --- Caused by: ---
# ActiveModel::ForbiddenAttributesError:
# ActiveModel::ForbiddenAttributesError
# ./app/models/model_set.rb:29:in `block in collection_attributes='
2020-11-17 18:51:48 +00:00
Luis Ramos
af713385d8
Add frozen string literal
2020-10-31 10:16:37 +00:00
Luis Ramos
c9972189d0
Change usage of Spree::Admin::BaseController to Admin::BaseController
2020-10-31 09:56:59 +00:00
Luis Ramos
eb07a91acb
Adapt code from Spree::Admin::BaseController to Admin::BaseController
2020-10-31 09:52:34 +00:00
Luis Ramos
66ba9ff73d
Move Spree::Admin::BaseController to Admin::BaseController
2020-10-31 09:51:37 +00:00
Luis Ramos
a53223aefc
Convert relation to array before using array only method sort_by!
2020-10-30 10:10:54 +00:00
Luis Ramos
66f27aad32
Explicitly use spree url helpers for spree routes
2020-09-17 13:59:41 +01:00
Matt-Yorkley
91789494b0
Fix error: Unpermitted attribute: order_cycle_ids
2020-08-15 17:03:19 +01:00
Matt-Yorkley
2eda8789d1
Add user id logging to OrderCycle an Schedule PaperTrail entries
2020-08-15 14:49:08 +01:00
Matt-Yorkley
1a132924d2
Fix StrongParameters for groups images
2020-07-09 10:00:02 +02:00
Luis Ramos
2d4326ded3
Replace empty? with blank? which is equivalent but a bit more resilient, returns false for nil
...
Present is not blank, so unless blank? becomes if present?
2020-07-01 14:08:07 +01:00
Luis Ramos
f54abbd376
Fix rubocop issues
2020-06-22 17:39:20 +01:00
Luis Ramos
f848a89a00
Rename update_attributes to update #rails4
2020-06-22 16:51:43 +01:00
Luis Ramos
8a61257547
Rename all before_filter to before_action, it's the same function with a new name
2020-06-22 13:11:57 +01:00
Pau Perez
456f369b76
Fix outstanding Rubocop violations
2020-06-15 10:17:34 +02:00
Luis Ramos
88896b7730
Merge branch 'master' into 3-0-stable-jun-2
2020-06-08 19:17:11 +01:00
Luis Ramos
c9a7a6e897
Merge branch 'master' into 3-0-stable-jun-2
2020-06-02 16:00:45 +01:00
Cillian O'Ruanaidh
deafe32354
Add support for using Open Street Map on the Map and Group pages.
...
The map is displayed using https://leafletjs.com/
To enable Open Street Map go to the Admin -> Configuration -> Content section and click 'Open Street Map Enabled'.
The 'Open Street Map Provider Name' setting can be used to configure different tile providers thanks to the Leaflet-providers extension (https://github.com/leaflet-extras/leaflet-providers )
Some tile providers require an API key, this can provided in JSON format e.g. '{ apiKey: 123 }' in the 'Open Street Map Provider Options' setting.
Each tile provider has their own usage policy so this should be checked before enabling Open Street Map.
The search field for the Open Street Map works differently than searching on Google Maps. It matches producers by their name or address because it was easier to implement instead of matching place names all over the world.
2020-05-31 18:42:55 +02:00