Skip to content

Commit

Permalink
Adding store_code as label for magento_active_payment_methods_count_t…
Browse files Browse the repository at this point in the history
…otal
  • Loading branch information
scolandrea committed Sep 29, 2023
1 parent 2b95c96 commit 7b5afed
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,21 @@ public function testAggregate(): void
->method('getId')
->willReturn(1);

$store1
->expects($this->once())
->method('getCode')
->willReturn('admin');

$store2
->expects($this->once())
->method('getId')
->willReturn(2);

$store2
->expects($this->once())
->method('getCode')
->willReturn('default');

$this->storeRepository
->expects($this->once())
->method('getList')
Expand All @@ -72,8 +82,14 @@ public function testAggregate(): void
->with(...[2])
->willReturn(['a']);

$labels1 = ['store_id' => 1];
$labels2 = ['store_id' => 2];
$labels1 = [
'store_id' => 1,
'store_code' => 'admin'
];
$labels2 = [
'store_id' => 2,
'store_code' => 'default'
];

$this->updateMetricService
->expects($this->at(0))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,15 @@ public function aggregate(): bool

foreach ($storeList as $store) {
$storeId = $store->getId();
$storeCode = $store->getCode();

$activePaymentMethods = $this->paymentMethodList->getActiveList($storeId);
$activePaymentMethodsCount = (string)count($activePaymentMethods);

$labels = ['store_id' => $storeId];
$labels = [
'store_id' => $storeId,
'store_code' => $storeCode
];

$this->updateMetricService->update(self::METRIC_CODE, $activePaymentMethodsCount, $labels);
}
Expand Down

0 comments on commit 7b5afed

Please sign in to comment.