mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Fixed calculate of discount in premium subscription options.
This commit is contained in:
parent
5f3e7235a5
commit
e486cf1afa
1 changed files with 2 additions and 2 deletions
|
@ -11,7 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
namespace Api {
|
||||
|
||||
constexpr auto kDiscountDivider = 5.;
|
||||
constexpr auto kDiscountDivider = 1.;
|
||||
|
||||
Data::SubscriptionOption CreateSubscriptionOption(
|
||||
int months,
|
||||
|
@ -20,7 +20,7 @@ Data::SubscriptionOption CreateSubscriptionOption(
|
|||
const QString ¤cy,
|
||||
const QString &botUrl) {
|
||||
const auto discount = [&] {
|
||||
const auto percent = monthlyAmount * months / float64(amount) - 1.;
|
||||
const auto percent = 1. - float64(amount) / (monthlyAmount * months);
|
||||
return std::round(percent * 100. / kDiscountDivider)
|
||||
* kDiscountDivider;
|
||||
}();
|
||||
|
|
Loading…
Add table
Reference in a new issue