Simplify /door/ route card listing

This commit is contained in:
Tanner Collin 2020-02-07 09:53:39 +00:00
parent 668a0dd349
commit 2fd1d52a71
3 changed files with 6 additions and 22 deletions

View File

@ -288,15 +288,13 @@ class DoorViewSet(viewsets.ViewSet, List):
cards = models.Card.objects.filter(active_status='card_active')
active_member_cards = {}
# format cards to match Emrah's conversion script, fix later
for card in cards:
member = get_object_or_404(models.Member, id=card.member_id)
if member.paused_date: continue
active_member_cards[card.card_number] = dict(
name=member.first_name + ' ' + member.last_name[0],
id=member.id,
enabled=True,
active_member_cards[card.card_number] = '{} ({})'.format(
member.first_name + ' ' + member.last_name[0],
member.id,
)
return Response(active_member_cards)

View File

@ -855,9 +855,6 @@ Door
List all active cards of unpaused members.
The json dict format is to match the current front door controller's script
and will likely be changed in the future.
No authentication required.
**Example response**
@ -867,22 +864,12 @@ Door
.. sourcecode:: json
{
"0000001234": {
"name": "Tanner C",
"id": 1685,
"enabled": true
},
"000000ABCD": {
"name": "Tanner C",
"id": 1685,
"enabled": true
}
"0000001234": "Tanner C (1685)",
"000000ABCD": "Tanner C (1685)",
}
:json key: The dict keys are the card numbers.
:json int id: Member's ID.
:json name: Member's name.
:json boolean enabled: Always true.
:json value: Member's name and ID.
.. http:post:: /door/(card_number)/seen/

View File

@ -9,7 +9,6 @@ Install dependencies:
.. sourcecode:: bash
# Misc:
$ sudo apt update
$ sudo apt install memcached