senior's post-demo changes: parent report in the student's own account, Jalali birth date, invoices, math-only tutor, priced quotas

- remove the family app from the root (separate parent accounts, invite codes, parental
  settings); progress.0006 drops its tables, permissions and migration history, and
  Profile.parent_phone, the two family notification types and ?userId= on
  /api/progress/nodes go with it
- GET /api/user/weekly-report: last 7 days next to the 7 before (estimated minutes,
  questions, accuracy, islands, tutor questions) for the "parent report" page
- profile birthDate in Jalali (accounts/jalali.py), ages 5-99, birthYear derived from it
- GET /api/payment/invoices; orders now snapshot list price and plan title
- tutor answers only math: server pre-filter, scope rule in the prompt (tutor-v11),
  refusal marker replaced with fixed text; self-harm gets a help line instead
- streamed answers now record token usage (it was always 0)
- daily tutor quota: AI_DAILY_QUOTA_FREE (default 3) vs Plan.ai_daily_quota
- delete_users management command for wiping test accounts across every app
- docs/ai-cost-and-guardrails.md: measured cost per question and guardrail results

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 02:38:43 +03:30
parent d5dbd1b23d
commit 39247f6d53
67 changed files with 1619 additions and 1140 deletions

View File

@@ -56,3 +56,23 @@ class OrderDetailResponseSerializer(serializers.Serializer):
status = serializers.CharField()
amount = serializers.IntegerField()
transactions = TransactionSerializer(many=True)
class InvoiceSerializer(serializers.Serializer):
orderId = serializers.CharField()
invoiceNumber = serializers.CharField(help_text='شماره‌ی فاکتور: «TD-» و شناسه‌ی سفارش، شش رقمی.')
status = serializers.ChoiceField(choices=['pending', 'paid', 'failed'])
provider = serializers.CharField(help_text='gateway (زرین‌پال) یا bazaar')
planTitle = serializers.CharField(allow_blank=True)
listPrice = serializers.IntegerField(allow_null=True, help_text='قیمتِ پایه پیش از تخفیف؛ null برای سفارش‌های پیش از ۱۴۰۵-۰۷-۰۹.')
discountAmount = serializers.IntegerField(allow_null=True)
discountCode = serializers.CharField(allow_blank=True)
amount = serializers.IntegerField(help_text='مبلغِ پرداختی (پس از تخفیف).')
currency = serializers.CharField()
createdAt = serializers.DateTimeField()
paidAt = serializers.DateTimeField(allow_null=True)
refId = serializers.CharField(allow_blank=True, help_text='کدِ پیگیریِ پرداخت (شماره‌ی مرجعِ زرین‌پال/بازار).')
class InvoiceListResponseSerializer(serializers.Serializer):
invoices = InvoiceSerializer(many=True)