add newsletter
This commit is contained in:
@@ -182,6 +182,7 @@ class BotConfigSnapshot:
|
||||
continue
|
||||
|
||||
title, description, squad_groups = spec
|
||||
use_duration_suffix = len(pairs) > 1
|
||||
for raw_days, raw_amount in pairs:
|
||||
if not raw_days.isdigit() or not raw_amount.isdigit():
|
||||
continue
|
||||
@@ -191,7 +192,7 @@ class BotConfigSnapshot:
|
||||
if days <= 0 or amount_rub <= 0:
|
||||
continue
|
||||
|
||||
plan_code = f"{normalized_code}_{days}"
|
||||
plan_code = f"{normalized_code}_{days}" if use_duration_suffix else normalized_code
|
||||
values.append(
|
||||
PaymentPlanSettings(
|
||||
code=plan_code,
|
||||
@@ -917,6 +918,7 @@ class BotConfigService(StaticBotConfigService):
|
||||
raise ValueError("Коды подписок не должны повторяться.")
|
||||
|
||||
title, description, squad_groups = spec
|
||||
use_duration_suffix = len(pairs) > 1
|
||||
for raw_days, raw_amount in pairs:
|
||||
if not raw_days.isdigit() or not raw_amount.isdigit():
|
||||
raise ValueError("Дни и цена должны быть целыми положительными числами.")
|
||||
@@ -926,7 +928,7 @@ class BotConfigService(StaticBotConfigService):
|
||||
if days <= 0 or amount_rub <= 0:
|
||||
raise ValueError("У подписок дни и цена должны быть больше нуля.")
|
||||
|
||||
plan_code = f"{normalized_code}_{days}"
|
||||
plan_code = f"{normalized_code}_{days}" if use_duration_suffix else normalized_code
|
||||
values.append(
|
||||
PaymentPlanSettings(
|
||||
code=plan_code,
|
||||
|
||||
Reference in New Issue
Block a user