Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count only completed orders #3125

Merged
merged 1 commit into from
Mar 1, 2019
Merged

Conversation

brchristian
Copy link
Contributor

Description

In the backend User#index action, we use the display_lifetime_value helper to get the total value of all completed orders. However, we display the count of all orders, including incomplete orders, which is inconsistent.

This commit changes this behavior and uses the existing order_count helper.

Note that one strange aspect of the current order_count helper is that it converts the count to a decimal unnecessarily, which will appear strangely, (e.g., 1.0) in the backend view. This is fixed in a separate PR by #3124.

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)

In the backend `User#index` action, we use the [`display_lifetime_value`](https://github.com/solidusio/solidus/blob/master/core/app/models/concerns/spree/user_reporting.rb#L8-L10) helper to get the total value of all _completed_ orders. However, we display the count of _all_ orders, which is inconsistent.

This commit changes this behavior and uses the existing [`order_count`](https://github.com/solidusio/solidus/blob/master/core/app/models/concerns/spree/user_reporting.rb#L12-L14) helper.

Note that one strange aspect of the current `order_count` helper is that it converts the count to a decimal unnecessarily, which will appear strangely, (e.g., `1.0`) in the backend view. This is fixed in a separate PR by solidusio#3124.
Copy link
Contributor

@aitbw aitbw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @brchristian! 👏

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍Thanks, @brchristian!

Copy link
Contributor

@jacobherrington jacobherrington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! 👏

@jacobherrington jacobherrington merged commit 3de6763 into solidusio:master Mar 1, 2019
@brchristian brchristian deleted the patch-5 branch March 1, 2019 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants