Return all high scores from API
This commit is contained in:
parent
64e328c137
commit
b47c773b16
|
@ -1490,7 +1490,7 @@ class PinballViewSet(Base):
|
||||||
members = models.Member.objects.all()
|
members = models.Member.objects.all()
|
||||||
members = members.annotate(
|
members = members.annotate(
|
||||||
pinball_score=Max('user__scores__score'),
|
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 = []
|
scores = []
|
||||||
|
|
||||||
|
@ -1498,6 +1498,7 @@ class PinballViewSet(Base):
|
||||||
scores.append(dict(
|
scores.append(dict(
|
||||||
name=member.preferred_name + ' ' + member.last_name[0],
|
name=member.preferred_name + ' ' + member.last_name[0],
|
||||||
score=member.pinball_score,
|
score=member.pinball_score,
|
||||||
|
member_id=member.id,
|
||||||
))
|
))
|
||||||
|
|
||||||
return Response(scores)
|
return Response(scores)
|
||||||
|
|
|
@ -112,7 +112,7 @@ export function DisplayScores(props) {
|
||||||
<>
|
<>
|
||||||
<Header size='large'>Pinball High Scores</Header>
|
<Header size='large'>Pinball High Scores</Header>
|
||||||
|
|
||||||
{scores && scores.map((x, i) =>
|
{scores && scores.slice(0, 5).map((x, i) =>
|
||||||
<div key={i}>
|
<div key={i}>
|
||||||
<Header size='medium'>#{i+1} — {x.name}. {i === 0 ? '👑' : ''}</Header>
|
<Header size='medium'>#{i+1} — {x.name}. {i === 0 ? '👑' : ''}</Header>
|
||||||
<p>{x.score.toLocaleString()}</p>
|
<p>{x.score.toLocaleString()}</p>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user