fix heart refill and grant unlimited hearts to active subscribers
next_refill_at was set on UserHearts but never read or recalculated, so a heart lost to zero never came back. UserHearts.apply_regen() now catches up missed 24h intervals on read/deduct, and lose_heart() starts the timer only when it isn't already running. Any user with an active (non-expired) subscription now skips heart deduction entirely, regardless of which plan they're on — good enough for now until per-plan perks are needed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -39,3 +39,4 @@ class UserHeartsResponseSerializer(serializers.Serializer):
|
||||
currentHearts = serializers.IntegerField()
|
||||
maxHearts = serializers.IntegerField()
|
||||
nextRefillAt = serializers.DateTimeField(allow_null=True)
|
||||
isUnlimited = serializers.BooleanField()
|
||||
|
||||
Reference in New Issue
Block a user