Order API: Include ID of check-in

This commit is contained in:
Raphael Michel
2020-09-18 13:11:34 +02:00
parent e7fd0f116b
commit bfa20e995a
4 changed files with 12 additions and 3 deletions

View File

@@ -201,6 +201,7 @@ addon_to integer Internal ID of
subevent integer ID of the date inside an event series this position belongs to (or ``null``). subevent integer ID of the date inside an event series this position belongs to (or ``null``).
pseudonymization_id string A random ID, e.g. for use in lead scanning apps pseudonymization_id string A random ID, e.g. for use in lead scanning apps
checkins list of objects List of check-ins with this ticket checkins list of objects List of check-ins with this ticket
├ id integer Internal ID of the check-in event
├ list integer Internal ID of the check-in list ├ list integer Internal ID of the check-in list
├ datetime datetime Time of check-in ├ datetime datetime Time of check-in
├ type string Type of scan (defaults to ``entry``) ├ type string Type of scan (defaults to ``entry``)

View File

@@ -122,7 +122,7 @@ class AnswerSerializer(I18nAwareModelSerializer):
class CheckinSerializer(I18nAwareModelSerializer): class CheckinSerializer(I18nAwareModelSerializer):
class Meta: class Meta:
model = Checkin model = Checkin
fields = ('datetime', 'list', 'auto_checked_in', 'type') fields = ('id', 'datetime', 'list', 'auto_checked_in', 'type')
class OrderDownloadsField(serializers.Field): class OrderDownloadsField(serializers.Field):

View File

@@ -402,6 +402,7 @@ def test_list_all_items_positions(token_client, organizer, event, clist, clist_a
c = order.positions.first().checkins.create(list=clist_all) c = order.positions.first().checkins.create(list=clist_all)
p1['checkins'] = [ p1['checkins'] = [
{ {
'id': c.pk,
'list': clist_all.pk, 'list': clist_all.pk,
'datetime': c.datetime.isoformat().replace('+00:00', 'Z'), 'datetime': c.datetime.isoformat().replace('+00:00', 'Z'),
'auto_checked_in': False, 'auto_checked_in': False,
@@ -441,6 +442,7 @@ def test_list_all_items_positions(token_client, organizer, event, clist, clist_a
c = order.positions.last().checkins.create(list=clist_all) c = order.positions.last().checkins.create(list=clist_all)
p2['checkins'] = [ p2['checkins'] = [
{ {
'id': c.pk,
'list': clist_all.pk, 'list': clist_all.pk,
'datetime': c.datetime.isoformat().replace('+00:00', 'Z'), 'datetime': c.datetime.isoformat().replace('+00:00', 'Z'),
'auto_checked_in': False, 'auto_checked_in': False,

View File

@@ -810,8 +810,14 @@ def test_orderposition_list(token_client, organizer, event, order, item, subeven
with scopes_disabled(): with scopes_disabled():
cl = event.checkin_lists.create(name="Default") cl = event.checkin_lists.create(name="Default")
op.checkins.create(datetime=datetime.datetime(2017, 12, 26, 10, 0, 0, tzinfo=UTC), list=cl) c = op.checkins.create(datetime=datetime.datetime(2017, 12, 26, 10, 0, 0, tzinfo=UTC), list=cl)
res['checkins'] = [{'datetime': '2017-12-26T10:00:00Z', 'list': cl.pk, 'auto_checked_in': False, 'type': 'entry'}] res['checkins'] = [{
'id': c.pk,
'datetime': '2017-12-26T10:00:00Z',
'list': cl.pk,
'auto_checked_in': False,
'type': 'entry'
}]
resp = token_client.get( resp = token_client.get(
'/api/v1/organizers/{}/events/{}/orderpositions/?has_checkin=true'.format(organizer.slug, event.slug)) '/api/v1/organizers/{}/events/{}/orderpositions/?has_checkin=true'.format(organizer.slug, event.slug))
assert [res] == resp.data['results'] assert [res] == resp.data['results']