Files
MathApp/progress/admin.py
Zareian 96f0204fcf refill hearts like Duolingo: one every 5 hours, all of them after 24
Each heart used to take 24 hours, so a student who lost all five waited up to
five days. Now one heart returns every 5 hours, and 24 hours after the first
heart was lost they all come back at once (the owner's call). /api/user/hearts
reports both times (nextRefillAt, fullRefillAt); an existing timer longer than
5 hours is shortened the first time it is read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-24 06:58:39 +03:30

37 lines
1.1 KiB
Python

from django.contrib import admin
from .models import ActiveDay, Character, LeaderboardEntry, StreakRecord, UserHearts, UserStats
@admin.register(UserStats)
class UserStatsAdmin(admin.ModelAdmin):
list_display = ('id', 'user_id', 'xp', 'coins', 'progress_percent', 'selected_character_id')
@admin.register(Character)
class CharacterAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'slug', 'icon', 'unlock_xp', 'order')
ordering = ('order', 'unlock_xp')
@admin.register(LeaderboardEntry)
class LeaderboardEntryAdmin(admin.ModelAdmin):
list_display = ('id', 'user_id', 'period', 'xp_in_period', 'rank')
list_filter = ('period',)
class ActiveDayInline(admin.TabularInline):
model = ActiveDay
extra = 1
@admin.register(StreakRecord)
class StreakRecordAdmin(admin.ModelAdmin):
list_display = ('id', 'user_id', 'current_streak', 'longest_streak')
inlines = [ActiveDayInline]
@admin.register(UserHearts)
class UserHeartsAdmin(admin.ModelAdmin):
list_display = ('id', 'user_id', 'current_hearts', 'max_hearts', 'next_refill_at', 'full_refill_at')