Improve cluster tariff error handling / Fix hot leads filtering logic
This commit is contained in:
@@ -18,6 +18,8 @@ async def get_hot_leads(session: AsyncSession):
|
||||
select(Payment.tg_id)
|
||||
.distinct()
|
||||
.where(Payment.amount > 0)
|
||||
.where(Payment.status == "success")
|
||||
.where(Payment.payment_system.notin_(["referral", "coupon", "cashback"]))
|
||||
.where(~Payment.tg_id.in_(subquery))
|
||||
)
|
||||
|
||||
|
||||
@@ -160,7 +160,9 @@ async def count_hot_leads(session: AsyncSession) -> int:
|
||||
|
||||
stmt = (
|
||||
select(Payment.tg_id)
|
||||
.where(Payment.amount > 0)
|
||||
.where(Payment.status == "success")
|
||||
.where(Payment.payment_system.notin_(["referral", "coupon", "cashback"]))
|
||||
.where(not_(exists(subquery_active_keys.where(Key.tg_id == Payment.tg_id))))
|
||||
.distinct()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user