fix: correctly calculate dynamic trial remaining days and fix missing trial_end in admin API
This commit is contained in:
@@ -1573,6 +1573,7 @@ def get_student_detail(user_id: UUID, session: Session = Depends(get_session), c
|
|||||||
"created_at": user.created_at.isoformat(),
|
"created_at": user.created_at.isoformat(),
|
||||||
"last_active": user.last_active.isoformat(),
|
"last_active": user.last_active.isoformat(),
|
||||||
"subscription_end": user.subscription_end.isoformat() if user.subscription_end else None,
|
"subscription_end": user.subscription_end.isoformat() if user.subscription_end else None,
|
||||||
|
"trial_end": user.trial_end.isoformat() if user.trial_end else None,
|
||||||
"profile_image_url": user.profile_image_url,
|
"profile_image_url": user.profile_image_url,
|
||||||
"stats": {
|
"stats": {
|
||||||
"total_tests": len(attempts),
|
"total_tests": len(attempts),
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ export default function DashboardLayout({ children }: { children: ReactNode }) {
|
|||||||
{trialInfo.isTrialActive && (
|
{trialInfo.isTrialActive && (
|
||||||
<div className="bg-primary text-primary-foreground px-4 py-2.5 text-center text-sm font-bold flex justify-center items-center gap-2 shadow-sm shrink-0 z-30">
|
<div className="bg-primary text-primary-foreground px-4 py-2.5 text-center text-sm font-bold flex justify-center items-center gap-2 shadow-sm shrink-0 z-30">
|
||||||
<span className="size-2 rounded-full bg-primary-foreground animate-pulse"></span>
|
<span className="size-2 rounded-full bg-primary-foreground animate-pulse"></span>
|
||||||
{trialInfo.trialTotalDays} Days Free Trial — Day {trialInfo.trialDayNumber}
|
{trialInfo.trialDaysRemaining} Days Free Trial Remaining
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user