Subscriptions only: Bazaar panel prices (598/898/1398k), assistant quota 5/3/3 from a cost calculation, packs off sale

- subscription.0016: prices equal to the Bazaar panel (senior), ai_daily_quota 5/3/3, card features; packs on_sale=False
  (one paid pack order, user 26, keeps its credits; pack paths stay for that order and for admin).
- Quota math in docs/ai-cost-and-guardrails.md: ~77% of a Bazaar sale reaches us; worst case (full quota every day)
  the assistant costs 23/27/35% of it.
- Assistant quota message points to the subscription, not packs.
982 tests green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-12 19:57:16 +03:30
parent c0fa46be44
commit 9c3adc3e60
13 changed files with 95 additions and 40 deletions

View File

@@ -500,17 +500,15 @@ class YearlyPlanSeedTests(TestCase):
self.assertEqual((plan.price, plan.ai_daily_quota), (450_000, 9))
self.assertEqual(Plan.objects.filter(duration_days=30, on_sale=False).count(), 1)
def test_packs_and_new_subscriptions_are_on_sale(self):
def test_only_subscriptions_are_on_sale(self):
from django.core.cache import cache
cache.clear()
data = self.client.get('/api/subscription/plans').json()
packs = [p for p in data['plans'] if p['kind'] == 'pack']
subs = [p for p in data['plans'] if p['kind'] == 'subscription']
self.assertEqual([p['questionCredits'] for p in packs], [20, 60, 150])
self.assertEqual([p['heartsDays'] for p in packs], [7, 30, 60])
# subscription.0013: یک/سه/شش‌ماهه با سقفِ ۳ سوال در روز.
self.assertEqual([(p['durationDays'], p['price'], p['aiDailyQuota']) for p in subs],
[(30, 498_000, 3), (90, 798_000, 3), (180, 1_298_000, 3)])
# subscription.0016: بسته‌ها فروشی نیستند؛ قیمت‌ها همان پیشخانِ بازار؛ سقفِ دستیار ۵/۳/۳.
self.assertEqual({p['kind'] for p in data['plans']}, {'subscription'})
self.assertEqual([(p['durationDays'], p['price'], p['aiDailyQuota'], p['bazaarSku']) for p in data['plans']],
[(30, 598_000, 5, '10342'), (90, 898_000, 3, '10343'), (180, 1_398_000, 3, '10344')])
self.assertTrue(all(p['features'] for p in data['plans']))
self.assertEqual(data['freeAiDailyQuota'], 2)
# پلن‌های اشتراکی پاک نشده‌اند؛ فقط فروخته نمی‌شوند.
self.assertFalse(Plan.objects.get(title='اشتراک یک‌ساله').on_sale)