Carlos Chitty
00aa60c8a3
Correct Style/ReturnNilInPredicateMethodDefinition rubocop offenses
...
Explicitly return false instead of nil
2025-06-04 10:25:50 -04:00
Adrien Chauve
9b93102a96
More fixes
2022-02-16 10:23:22 +11:00
Matt-Yorkley
1d5077061e
Remove andand
...
This old gem implemented some functionality for handling nils which is no longer needed, as it's provided natively by Ruby with the &. operator.
2021-09-08 14:28:31 +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
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
Luis Ramos
b6dc46a911
Fix rubocop issue by nesting module and class declarations
...
No file contents changed
2020-10-30 16:14:34 +00:00
Luis Ramos
4a2684e3d9
Fix rubocop issues
2020-10-29 13:38:36 +00:00
Luis Ramos
e860e2ca57
Add label to customer balance so it's clear to the manager what's the balance status: credit owed or balance due
2020-10-29 13:38:36 +00:00
Luis Ramos
da69dca471
Make customer balance serialize with the currency
2020-10-29 13:38:36 +00:00
Luis Ramos
e4f3aae7c0
Add customer balance to customer list
2020-10-29 13:38:36 +00:00
Matt-Yorkley
4c41c84cc1
Refactor tag rules loading for customers
...
Fixes N+1 queries on customer tags
2020-04-10 10:12:32 +02:00
luisramos0
9404aacfb2
run rubocop --auto-correct
2019-11-10 18:42:43 +00:00
luisramos0
a44a251d96
Remove duplicated attributes tag from all serializers to create consistency
2019-09-19 16:32:09 +01:00
luisramos0
86b0d71c7e
Result of rubocop auto-correct and rebuilding rubocop_manual_todo
2019-05-28 12:57:29 +01:00
Rob Harrington
a03dd1e10c
Serialize default card auth and presence for Customers
2018-07-05 19:26:11 +10:00
Bing Xie
a4755865ca
Fix customer name
2016-10-21 11:58:50 +11:00
Bing Xie
21ed37189a
Only search customers in user managed enterprises
2016-10-21 10:51:36 +11:00
Bing Xie
1877bea68d
Customer serializer without tag_rule_mapping option
2016-10-21 10:51:36 +11:00
Bing Xie
ae2357d309
Edit customer address with first name and last name
2016-10-21 10:51:36 +11:00
Bing Xie
5b40c745f3
Add address serializer to customer serializer
2016-08-12 14:44:59 +10:00
Bing Xie
7f203f5491
Show billing address and shipping address on customers index page
2016-08-12 14:44:59 +10:00
Bing Xie
add39f7401
Enterprise user can update customer's name
2016-08-12 14:44:59 +10:00
Rob Harrington
ddcfe1535a
Making TagRule autocomplete available to models other than Customer
...
Incorporate ng admin.tags module and rails TagController into existing admin.tagRules module + TagRuleController
2016-05-25 08:10:20 +10:00
Maikel Linke
fa5fa9e228
Auto-complete tags on customers page
...
- new controller serving tags for an enterprise as JSON
- customers page suggesting these tags
- emphasising tags that have rules
2016-04-29 15:18:17 +10:00
Rob Harrington
b364994cc8
Adding tags input to customer index using ngTagsInput
2015-05-13 12:44:37 +10:00
Rob Harrington
220f42fcf2
Customers controller serializes data for json requests, just renders view without data for html
2015-05-13 12:44:32 +10:00