recognition: Recognition model w. grant_if_new; sky_save returns stargazer on first chart save — TDD
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ from django.views.decorators.csrf import ensure_csrf_cookie
|
||||
from apps.applets.utils import applet_context, apply_applet_toggle
|
||||
from apps.dashboard.forms import ExistingNoteItemForm, ItemForm
|
||||
from apps.dashboard.models import Item, Note
|
||||
from apps.drama.models import Recognition
|
||||
from apps.epic.utils import _compute_distinctions
|
||||
from apps.lyric.models import PaymentMethod, Token, User, Wallet
|
||||
|
||||
@@ -372,7 +373,19 @@ def sky_save(request):
|
||||
'sky_birth_dt', 'sky_birth_lat', 'sky_birth_lon',
|
||||
'sky_birth_place', 'sky_birth_tz', 'sky_house_system', 'sky_chart_data',
|
||||
])
|
||||
return JsonResponse({"saved": True})
|
||||
|
||||
recognition_payload = None
|
||||
if user.sky_chart_data:
|
||||
recog, created = Recognition.grant_if_new(user, "stargazer")
|
||||
if created:
|
||||
recognition_payload = {
|
||||
"slug": recog.slug,
|
||||
"title": "Stargazer",
|
||||
"description": "You saved your first personal sky chart.",
|
||||
"earned_at": recog.earned_at.isoformat(),
|
||||
}
|
||||
|
||||
return JsonResponse({"saved": True, "recognition": recognition_payload})
|
||||
|
||||
|
||||
@login_required(login_url="/")
|
||||
|
||||
Reference in New Issue
Block a user