Skip to content

Commit

Permalink
#28628: GraphQL price range numeric values
Browse files Browse the repository at this point in the history
- Fixed tests
  • Loading branch information
gallyamov committed Jun 17, 2020
1 parent a9d0a72 commit 622e2ae
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
Expand Up @@ -46,9 +46,7 @@ public function build(
/** @var DynamicBucket $bucket */
$algorithm = $this->algorithmRepository->get($bucket->getMethod(), ['dataProvider' => $dataProvider]);
$data = $algorithm->getItems($bucket, $dimensions, $this->getEntityStorage($queryResult));
$resultData = $this->prepareData($data);

return $resultData;
return $this->prepareData($data);
}

/**
Expand Down Expand Up @@ -78,7 +76,8 @@ private function prepareData($data)
$resultData = [];
foreach ($data as $value) {
$rangeName = "{$value['from']}_{$value['to']}";
$resultData[$rangeName] = array_merge(['value' => $rangeName], $value);
$value['value'] = $rangeName;
$resultData[$rangeName] = $value;
}

return $resultData;
Expand Down
Expand Up @@ -570,8 +570,8 @@ public function testSearchAndFilterByCustomAttribute()
],
[
'count' => 1,
'label' => '40-*',
'value' => '40_*',
'label' => '40-50',
'value' => '40_50',

],
],
Expand Down Expand Up @@ -1431,8 +1431,8 @@ public function testFilterProductsForExactMatchingName()
'count' => 1,
],
[
'label' => '20-*',
'value' => '20_*',
'label' => '20-30',
'value' => '20_30',
'count' => 1,
]
]
Expand Down
Expand Up @@ -76,7 +76,7 @@ public function getFiltersDataProvider(): array
],
[
'label' => '<span class="price">$60.00</span> and above',
'value' => '60-',
'value' => '60-70',
'count' => 1,
],
],
Expand All @@ -94,7 +94,7 @@ public function getFiltersDataProvider(): array
],
[
'label' => '<span class="price">$50.00</span> and above',
'value' => '50-',
'value' => '50-60',
'count' => 1,
],
],
Expand Down
Expand Up @@ -32,7 +32,7 @@ public function testGetFilters(): void
['is_filterable_in_search' => 1],
[
['label' => '$10.00 - $19.99', 'value' => '10-20', 'count' => 1],
['label' => '$20.00 and above', 'value' => '20-', 'count' => 1],
['label' => '$20.00 and above', 'value' => '20-30', 'count' => 1],
]
);
}
Expand Down

0 comments on commit 622e2ae

Please sign in to comment.