diff --git a/apiserver/apiserver/api/models.py b/apiserver/apiserver/api/models.py
index b83fc26..0f9ac68 100644
--- a/apiserver/apiserver/api/models.py
+++ b/apiserver/apiserver/api/models.py
@@ -246,7 +246,7 @@ class PinballScore(models.Model):
# no history
- MY_FIELDS = ['started_at', 'game_id', 'player', 'score']
+ MY_FIELDS = ['started_at', 'game_id', 'player', 'score', 'user']
def __str__(self):
return str(self.started_at)
diff --git a/apiserver/apiserver/api/serializers.py b/apiserver/apiserver/api/serializers.py
index 8a1d4f5..8deecb2 100644
--- a/apiserver/apiserver/api/serializers.py
+++ b/apiserver/apiserver/api/serializers.py
@@ -183,6 +183,7 @@ class TransactionSerializer(serializers.ModelSerializer):
# hide info for non-vetted members so someone sitting
# in our parking lot can't scrape all our info
class OtherMemberSerializer(serializers.ModelSerializer):
+ pinball_score = serializers.IntegerField(required=False)
last_name = serializers.SerializerMethodField()
class Meta:
@@ -196,6 +197,7 @@ class OtherMemberSerializer(serializers.ModelSerializer):
'application_date',
'photo_small',
'public_bio',
+ 'pinball_score',
]
def get_last_name(self, obj):
@@ -206,6 +208,8 @@ class OtherMemberSerializer(serializers.ModelSerializer):
# vetted member viewing other members
class VettedOtherMemberSerializer(serializers.ModelSerializer):
+ pinball_score = serializers.IntegerField(required=False)
+
class Meta:
model = models.Member
fields = [
@@ -218,6 +222,7 @@ class VettedOtherMemberSerializer(serializers.ModelSerializer):
'photo_small',
'photo_large',
'public_bio',
+ 'pinball_score',
]
diff --git a/apiserver/apiserver/api/views.py b/apiserver/apiserver/api/views.py
index b92c9f4..bbcbfec 100644
--- a/apiserver/apiserver/api/views.py
+++ b/apiserver/apiserver/api/views.py
@@ -132,6 +132,10 @@ class SearchViewSet(Base, Retrieve):
).exclude(last_scanned__isnull=True).order_by('-last_scanned')
else:
queryset = []
+ elif sort == 'pinball_score':
+ queryset = queryset.annotate(
+ pinball_score=Max('user__scores__score'),
+ ).exclude(pinball_score__isnull=True).order_by('-pinball_score')
elif sort == 'everyone':
queryset = queryset.annotate(Count('user__transactions')).order_by('-user__transactions__count', 'id')
elif sort == 'best_looking':
diff --git a/webclient/src/Members.js b/webclient/src/Members.js
index 9af98aa..8433a25 100644
--- a/webclient/src/Members.js
+++ b/webclient/src/Members.js
@@ -11,6 +11,7 @@ import AbortController from 'abort-controller';
const memberSorts = {
recently_vetted: 'Recently Vetted',
last_scanned: 'Last Scanned',
+ pinball_score: 'Pinball Score',
newest_active: 'Newest',
//newest_overall: 'Newest Overall',
oldest_active: 'Oldest',
@@ -227,8 +228,17 @@ export function Members(props) {
{x.member.preferred_name} {x.member.last_name}
- Status: {x.member.status || 'Unknown'}
- Joined: {x.member.application_date || 'Unknown'}
+ {sort === 'pinball_score' ?
+ <>
+ Score: {x.member.pinball_score || 'Unknown'}
+ Rank: {i === 0 ? 'Pinball Wizard' : 'Not the Pinball Wizard'}
+ >
+ :
+ <>
+ Status: {x.member.status || 'Unknown'}
+ Joined: {x.member.application_date || 'Unknown'}
+ >
+ }
ID: {x.member.id}