mirror of
https://github.com/pretix/pretix.git
synced 2026-06-12 01:35:16 +00:00
Fix query
This commit is contained in:
@@ -1045,7 +1045,7 @@ def perform_checkin(op: OrderPosition, clist: CheckinList, given_answers: dict,
|
|||||||
|
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
# Lock order positions, if it is an entry. We don't need it for exits, as a race condition wouldn't be problematic
|
# Lock order positions, if it is an entry. We don't need it for exits, as a race condition wouldn't be problematic
|
||||||
opqs = OrderPosition.all
|
opqs = OrderPosition.all.select_related("order", "item")
|
||||||
if type != Checkin.TYPE_EXIT:
|
if type != Checkin.TYPE_EXIT:
|
||||||
opqs = opqs.select_for_update(of=OF_SELF)
|
opqs = opqs.select_for_update(of=OF_SELF)
|
||||||
op = opqs.get(pk=op.pk)
|
op = opqs.get(pk=op.pk)
|
||||||
|
|||||||
@@ -1186,7 +1186,7 @@ def test_rules_reasoning_prefer_number_over_date(event, position, clist):
|
|||||||
|
|
||||||
@pytest.mark.django_db(transaction=True)
|
@pytest.mark.django_db(transaction=True)
|
||||||
def test_position_queries(django_assert_max_num_queries, position, clist):
|
def test_position_queries(django_assert_max_num_queries, position, clist):
|
||||||
with django_assert_max_num_queries(13) as captured:
|
with django_assert_max_num_queries(12) as captured:
|
||||||
perform_checkin(position, clist, {})
|
perform_checkin(position, clist, {})
|
||||||
if 'sqlite' not in settings.DATABASES['default']['ENGINE']:
|
if 'sqlite' not in settings.DATABASES['default']['ENGINE']:
|
||||||
assert any('FOR UPDATE' in s['sql'] for s in captured)
|
assert any('FOR UPDATE' in s['sql'] for s in captured)
|
||||||
|
|||||||
Reference in New Issue
Block a user