Konrad
591885610a
Merge branch 'master' into task/11923-add-vouchers-to-oc-customer-total-report
2024-01-09 18:51:47 +01:00
Ahmed Ejaz
25c1f64876
Update lib/reporting/reports/orders_and_fulfillment/order_cycle_customer_totals.rb
...
Co-authored-by: Gaetan Craig-Riou <40413322+rioug@users.noreply.github.com >
2024-01-04 12:53:24 +05:00
Ahmed Ejaz
c06f251ff3
11923: update voucher_amount logic
2024-01-03 15:54:32 +05:00
Ahmed Ejaz
862edbe55b
11923: add voucher to OC customer total report
2023-12-30 14:35:37 +05:00
David Cook
e62cd0eb89
Add reports readme [doc]
...
It doesn't say much yet, but could be a helpful starting point. Hopefully we will add to it next time we're working on it.
[skip ci]
2023-12-29 13:58:55 +11:00
dung bui
738b338827
Merge branch 'master' into ft/include-vouchers-in-revenues-by-hub-report
2023-12-17 10:52:37 +07:00
David Cook
0e95b3211b
Disable most OutputSafety warnings
...
These all seem to require html_safe/raw, so we'll permit it.
Some of the spree code is a bit strange and could probably be improved, but I think it's ok for now.
2023-12-13 14:19:19 +11:00
Dung Bui
d8024eb526
include voucher tax adjustment in revenues by hub report
2023-12-09 12:40:51 +07:00
Neal Chambers
edbf4c15a9
Safely autocorrect Style/RedundantReturn
...
Inspecting 1513 files
.........................................................................................................................................................................................................................................................................................................C......................................................C............................................................................................................................................................................................................................................................................................................................................................................................................................................C.........................................................C.......C.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Offenses:
app/models/product_import/entry_validator.rb:200:7: C: [Corrected] Style/RedundantReturn: Redundant return detected.
return true unless Float(value, exception: false).nil?
^^^^^^
app/models/spree/stock/availability_validator.rb:30:9: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return line_item.target_shipment if line_item.target_shipment
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app/models/spree/stock/availability_validator.rb:31:9: C: [Corrected] Style/RedundantReturn: Redundant return detected.
return line_item.order.shipments.first if line_item.order&.shipments&.any?
^^^^^^
lib/reporting/reports/enterprise_fee_summary/summarizer.rb:41:11: C: [Corrected] Layout/EmptyLineAfterGuardClause: Add empty line after guard clause.
return DataRepresentations::IncomingExchangeLineItemFee if for_incoming_exchange?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/reporting/reports/enterprise_fee_summary/summarizer.rb:42:11: C: [Corrected] Style/RedundantReturn: Redundant return detected.
return DataRepresentations::OutgoingExchangeLineItemFee if for_outgoing_exchange?
^^^^^^
lib/stripe/authorize_response_patcher.rb:31:7: C: [Corrected] Style/RedundantReturn: Redundant return detected.
return url if url.match(%r{https?://\S+}) && url.include?("stripe.com")
^^^^^^
lib/tasks/data.rake:99:7: C: [Corrected] Style/RedundantReturn: Redundant return detected.
return true if Integer(value)
^^^^^^
1513 files inspected, 7 offenses detected, 7 offenses corrected
2023-11-17 09:00:50 +09:00
Maikel Linke
b83651a7ae
Avoid error when generating fee report
...
Instead some data is missing from the report. A slightly better outcome
but still wrong. This is tracked in another issue though.
2023-10-20 15:45:32 +11:00
Çağrı Özkan
877ea12645
Call in_time_zone on boundary parameters
2023-10-08 17:44:24 +02:00
Çağrı Özkan
a5a13761a8
Filter with open ended boundaries upon missing params
2023-10-04 01:05:41 +03:00
David Cook
2558855ad5
Merge pull request #11595 from openfoodfoundation/dependabot/bundler/rubocop-1.56.4
...
chore(deps-dev): bump rubocop from 1.56.3 to 1.56.4
2023-10-03 16:26:21 +11:00
Maikel Linke
fec6caf576
Remove unnecessary Rubocop disable
2023-10-02 16:18:51 +11:00
Konrad
06ebeeac0f
Merge pull request #11543 from rioug/11364-Voucher-fix-tax-report
...
[Vouchers] Fix Sales Tax Totals By Order report
2023-10-01 02:09:33 +02:00
Jean-Baptiste Bellet
2803f1c6b2
Group all orders by customer_id, email and distributor_id
...
Therefore have one (and only) row per customer
Co-Authored-By: Maikel <maikel@email.org.au >
2023-09-22 16:44:33 +01:00
Maikel Linke
adc5bf6e93
Simplify date filter in customers report
2023-09-22 16:44:33 +01:00
Jean-Baptiste Bellet
82ccdcca70
Customers report has only one report: Customers
...
No more `addresses` report
+ Fix pre-existing rubocop issues
+ Create method to simplify and remove CyclomaticComplexity error
2023-09-22 16:44:33 +01:00
Jean-Baptiste Bellet
5edc8d8ce1
Delete Mailing List report
2023-09-22 16:44:33 +01:00
Jean-Baptiste Bellet
c6c9cdca65
Add last completed order date
2023-09-22 16:44:33 +01:00
Jean-Baptiste Bellet
d2fbaa7cfd
Add total amount spent at the shop for the customer
2023-09-22 16:44:33 +01:00
Jean-Baptiste Bellet
d55098f94f
Add the number of orders for the customer
2023-09-22 16:44:33 +01:00
Jean-Baptiste Bellet
1378202732
Disable rubocop warning. Not sure how to handle it actually
2023-09-22 16:44:33 +01:00
Jean-Baptiste Bellet
cc26da6560
We'll need to get all the orders per line to count and sum them; prepare it
2023-09-22 16:44:33 +01:00
Jean-Baptiste Bellet
c134de850c
Add filter on completed_at of an order
2023-09-22 16:44:33 +01:00
Jean-Baptiste Bellet
9e295146cb
Remove supplier filter
2023-09-22 16:44:33 +01:00
Gaetan Craig-Riou
9e49da8fae
Add unit test for Reporting::Reports::SalesTax::SalesTaxTotalsByOrder
...
And a small refactoring.
Currently it only covers tax excluded from price
2023-09-22 10:17:50 +02:00
Gaetan Craig-Riou
bec5ad55dd
Use VoucherAdjustmentsService to retrieve tax part of the voucher
2023-09-22 10:17:50 +02:00
Neal Chambers
4596997547
Fix Style/HashSyntax
2023-09-16 09:05:31 +09:00
Gaetan Craig-Riou
0c005ad734
Sales Tax Totals by order included tax, fix tax amount when voucher applied
...
Plus specs
2023-09-14 10:21:50 +02:00
David Cook
ef1ccca4fa
Temporarily 'hide' report
...
The reports framework doesn't currently support hidden reports, but we can mark it with a strike-through at least.
2023-09-13 19:09:55 +02:00
David Cook
db8392ce81
Temporarily hide report
2023-09-13 19:09:55 +02:00
Mohamed ABDELLANI
4cb91da8b2
load only enterprise fees connected to incoming exchanges on the OC
2023-09-13 19:09:55 +02:00
Mohamed ABDELLANI
624b4c8ad2
fix calculation of the summary row's total excl tax
2023-09-13 19:09:55 +02:00
Mohamed ABDELLANI
a3f012c9fe
calculate tax total using existing rows
2023-09-13 19:09:55 +02:00
David Cook
e934bc7cb9
Ignore ClassLength
...
I'm never quite sure the best way to deal with these, so I added a comment to at least explain my justification.
2023-09-13 19:09:55 +02:00
David Cook
93cca56e68
Style/HashSyntax
2023-09-13 19:09:55 +02:00
Mohamed ABDELLANI
080e81e0fe
optimize join_supplier
2023-09-13 19:09:55 +02:00
Mohamed ABDELLANI
6dd70d310c
fix the calculation of the cost of produce
...
we want the cost of produce to only include the items produced by the supplier used to group the rows.
2023-09-13 19:09:55 +02:00
Mohamed ABDELLANI
7a875723ca
fix order_cycle summary row.
...
the summary row has to only include the line items coming from the supplier used in the grouping key
2023-09-13 19:09:55 +02:00
Mohamed ABDELLANI
7b0a99c652
fix enterprise fees listing
...
For every producer, we want to only show the enterprise fees that are applied to at lease one of his products.
To do that, we use the order cycle to build a list of the enterprise fees for every variant.
Every variant will have coordinator fee + additional fees coming from incoming/outgoing exchanges.
2023-09-13 19:09:55 +02:00
Mohamed ABDELLANI
1cd0f88c1e
fix supplier filter
2023-09-13 19:09:55 +02:00
David Cook
9ae65e135b
Rails/Pick
...
Prefer pick("sum(amount)") over pluck("sum(amount)").first
2023-09-13 19:09:55 +02:00
David Cook
55742f40d1
Show a line for cost of produce
...
Utilising a second group_by rule, we can add a second summary_row. The cost of produce is also inserted into the TOTALS row as per requirements.
2023-09-13 19:09:55 +02:00
David Cook
cc54e2e6c7
Add long report class to .rubocop_todo.yml
...
Long classes are a problem that would be good to resolve one day. But it's hard to resolve with the current reports framework.
2023-09-13 19:09:55 +02:00
Mohamed ABDELLANI
ee7668e713
implement enterprise fee report filters
...
squash Reformat/Refactor spec
2023-09-13 19:09:55 +02:00
Mohamed ABDELLANI
2880fd5a87
implement EnterpriseFeesWithTaxReportByProducer
...
squash Re-format code
squash Apply suggestions from code review
Co-authored-by: Maikel <maikel@email.org.au >
squash More refactor
squash Update lib/reporting/reports/enterprise_fee_summary/enterprise_fees_with_tax_report_by_producer.rb
2023-09-13 19:09:55 +02:00
Gaetan Craig-Riou
9925399292
Sales Tax Totals by order, fix tax amount when voucher applied
...
Apply the tax discount to the tax collumn when a voucher is added
to the order, and update total excluding tax accordingly.
2023-09-12 14:36:28 +02:00
Neal Chambers
4cce85378c
Safely autocorrect Rails/WhereNot
...
Inspecting 1488 files
...........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................C....................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Offenses:
lib/reporting/reports/users_and_enterprises/base.rb:27:14: C: [Corrected] Rails/WhereNot: Use where.not(enterprises: { id: nil }) instead of manually constructing negated SQL in where.
.where("enterprises.id IS NOT NULL")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/reporting/reports/users_and_enterprises/base.rb:39:14: C: [Corrected] Rails/WhereNot: Use where.not(enterprise_id: nil) instead of manually constructing negated SQL in where.
.where("enterprise_id IS NOT NULL")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/reporting/reports/users_and_enterprises/base.rb:40:14: C: [Corrected] Rails/WhereNot: Use where.not(user_id: nil) instead of manually constructing negated SQL in where.
.where("user_id IS NOT NULL")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1488 files inspected, 3 offenses detected, 3 offenses corrected
2023-09-01 08:55:56 +09:00
Maikel Linke
4c3d619260
Report customers in deterministic order
...
The result could be random before which led to a flaky spec. I could
have adjusted the spec but I thought that it may be better UX as well to
be deterministic, especially when exporting into spreadsheets.
2023-08-23 17:03:30 +10:00