Skip to content

Commit

Permalink
Fix filtering of customers
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Jun 20, 2024
1 parent 7d8b311 commit ec04f7e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes for Plugin Sales

## 2.8.7 - 2024-06-20

### Fixed

- Fixed a bug that was causing the filtering of customers to fail.

## 2.8.6 - 2024-06-03

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "putyourlightson/craft-plugin-sales",
"description": "Your Craft CMS plugin sales visualised in the control panel.",
"version": "2.8.6",
"version": "2.8.7",
"type": "craft-plugin",
"homepage": "https://putyourlightson.com/plugins/plugin-sales",
"license": "proprietary",
Expand Down
2 changes: 1 addition & 1 deletion src/services/ReportsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getSalesCount(string $customer = null, string $start = null, str
public function getCustomersData(string $start = null, string $end = null, string $orderBy = null, string $sortBy = null, ?int $offset = null, ?int $limit = null, string $search = null): array
{
$query = $this->_getTotalsQuery($start, $end)
->addSelect(['customer', 'id' => 'MIN([[id]])'])
->addSelect(['customer', 'id' => 'MIN(' . SaleRecord::tableName() . '.[[id]])'])
->groupBy(['customer'])
->orderBy([$orderBy => ($sortBy == 'desc' ? SORT_DESC : SORT_ASC), 'id' => SORT_ASC])
->offset($offset)
Expand Down

0 comments on commit ec04f7e

Please sign in to comment.