Added sales total by products#38
Conversation
tvdeyen
left a comment
There was a problem hiding this comment.
Thanks, this is helpful. We need some test and eager loading would be necessary to prevent a N+1 query
| <tr> | ||
| <td><%= currency %></td> | ||
| <td> | ||
| <% if (variant = ::Spree::Variant.where(id: variant_id).first) %> |
There was a problem hiding this comment.
Can we eager load in the controller this to prevent a N+1 query here, please?
| get :sales_total | ||
| post :sales_total | ||
| get :sales_total_by_product | ||
| post :sales_total_by_product |
There was a problem hiding this comment.
Not sure why we would need the post route here.
| <% admin_breadcrumb(link_to t('spree.reports'), spree.admin_reports_path) %> | ||
| <% admin_breadcrumb(t('spree.sales_total_by_product')) %> | ||
|
|
||
| <% content_for :page_actions do %> |
There was a problem hiding this comment.
This empty block can be omitted
| </tbody> | ||
| </table> | ||
| <div style="text-align: center"> | ||
| <i>Not including tax, shipping, and adjustments</i> |
There was a problem hiding this comment.
Can we translate this note, please?
| @totals[order.currency][:sales_total] += line_item.display_amount.money | ||
| end | ||
| end | ||
| end |
There was a problem hiding this comment.
Would like to see a spec for this
| params[:q] = search_params | ||
|
|
||
| @search = Order.complete.not_canceled.ransack(params[:q]) | ||
| @search = Order.complete.not_canceled.where(payment_state: "paid").ransack(params[:q]) |
There was a problem hiding this comment.
This change seems to break the existing specs.
| @search = Order.complete.not_canceled.where(payment_state: "paid").ransack(params[:q]) | ||
| @orders = @search.result | ||
|
|
||
| Rails.logger.info("Orders Total: #{@orders.count}") |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
No description provided.