Return all high scores from API

This commit is contained in:
Tanner Collin 2023-02-15 00:18:30 +00:00
parent 64e328c137
commit b47c773b16
2 changed files with 3 additions and 2 deletions

View File

@ -1490,7 +1490,7 @@ class PinballViewSet(Base):
members = models.Member.objects.all()
members = members.annotate(
pinball_score=Max('user__scores__score'),
).exclude(pinball_score__isnull=True).order_by('-pinball_score')[:5]
).exclude(pinball_score__isnull=True).order_by('-pinball_score')
scores = []
@ -1498,6 +1498,7 @@ class PinballViewSet(Base):
scores.append(dict(
name=member.preferred_name + ' ' + member.last_name[0],
score=member.pinball_score,
member_id=member.id,
))
return Response(scores)

View File

@ -112,7 +112,7 @@ export function DisplayScores(props) {
<>
<Header size='large'>Pinball High Scores</Header>
{scores && scores.map((x, i) =>
{scores && scores.slice(0, 5).map((x, i) =>
<div key={i}>
<Header size='medium'>#{i+1} {x.name}. {i === 0 ? '👑' : ''}</Header>
<p>{x.score.toLocaleString()}</p>