Skip to content

Commit

Permalink
Fix value for monthly quantity if unit type is hours (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
tafid committed Feb 12, 2021
1 parent 88a7b70 commit 673801f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/logic/bill/MonthlyQuantity.php
Expand Up @@ -31,9 +31,12 @@ class MonthlyQuantity extends DefaultQuantityFormatter implements ContextAwareQu
*/
public function format(): string
{
$text = Yii::t('hipanel:finance', '{quantity, plural, one{# day} other{# days}}', ['quantity' => $this->getClientValue()]);
$unitName = $this->getQuantity()->getUnit()->getName();
if ($unitName === 'hour') {
return Yii::t('hipanel:finance', '{quantity, plural, one{# hour} few{# hours} other{# hours}}', ['quantity' => $this->getQuantity()->getQuantity()]);
}

return $text;
return Yii::t('hipanel:finance', '{quantity, plural, one{# day} other{# days}}', ['quantity' => $this->getClientValue()]);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/messages/ru/hipanel:finance.php
Expand Up @@ -63,6 +63,7 @@
'{quantity, plural, one{# day} other{# days}}' => '{quantity, plural, one{# день} few{# дня} other{# дней}}',
'{quantity, plural, one{# year} other{# years}}' => '{quantity, plural, one{# год} few{# года} other{# лет}}',
'{quantity, time, HH:mm} hour(s)' => '{quantity, time, HH:mm} час(ов)',
'{quantity, plural, one{# hour} few{# hours} other{# hours}}' => '{quantity, plural, one{# час} few{# часа} other{# часов}}',
'{quantity} IP' => '{quantity} IP',
'Held payments' => 'Ожидающие платежи',
'Provided services' => 'Предоставленные услуги',
Expand Down

0 comments on commit 673801f

Please sign in to comment.