fix: Cast Decimal to float

This commit is contained in:
2025-09-24 09:44:33 +10:00
parent 0c4b2bfe32
commit 891e121e99

View File

@@ -87,32 +87,32 @@ async def prepare_subathon(profiler: ProfilesRegistry, subathon: ActiveSubathon)
last_contrib = ContributionPayload(
user_name=name,
user_id=user_id,
amount=contrib.score,
amount=float(contrib.score),
seconds_added=subathon.get_score_time(contrib.score),
timestamp=contrib.created_at.isoformat()
)
score_table = ScoreTablePayload(
bit_score=subathon.subathondata.bit_score,
t1_score=subathon.subathondata.sub1_score,
t2_score=subathon.subathondata.sub2_score,
t3_score=subathon.subathondata.sub3_score,
score_time=subathon.subathondata.score_time,
bit_score=float(subathon.subathondata.bit_score),
t1_score=float(subathon.subathondata.sub1_score),
t2_score=float(subathon.subathondata.sub2_score),
t3_score=float(subathon.subathondata.sub3_score),
score_time=int(subathon.subathondata.score_time),
)
payload = SubathonPayload(
name=subathon.subathondata.name,
end_at=(await subathon.get_ending()).isoformat(),
is_running=(subathon.running),
score_table=score_table,
total_contribution=await subathon.get_score(),
total_contribution=float(await subathon.get_score()),
goals_met=goals_met,
goals_total=total_goals,
last_goal=GoalPayload(
required=last_goal.required_score,
required=float(last_goal.required_score),
name=last_goal.description,
) if last_goal is not None else None,
next_goal=GoalPayload(
required=next_goal.required_score,
required=float(next_goal.required_score),
name=next_goal.description,
) if next_goal is not None else None,
last_contribution=last_contrib