Checkin: Allow to use presence state in rules (#4061)

This commit is contained in:
Raphael Michel
2024-04-18 13:15:31 +02:00
committed by GitHub
parent f09f07ec7c
commit b2842ec3a0
7 changed files with 102 additions and 3 deletions

View File

@@ -746,6 +746,33 @@ def test_rules_scan_days(event, position, clist):
assert 'Maximum number of days with an entry exceeded.' in str(excinfo.value)
@pytest.mark.django_db
def test_rules_scan_entry_status(position, clist):
# Ticket is valid three times
clist.allow_multiple_entries = True
clist.rules = {
"or": [
{"==": [{"var": "entry_status"}, "absent"]},
{"<": [{"var": "entries_number"}, 1]}
]
}
clist.save()
assert OrderPosition.objects.filter(SQLLogic(clist).apply(clist.rules), pk=position.pk).exists()
perform_checkin(position, clist, {})
assert not OrderPosition.objects.filter(SQLLogic(clist).apply(clist.rules), pk=position.pk).exists()
with pytest.raises(CheckInError) as excinfo:
perform_checkin(position, clist, {})
assert excinfo.value.code == 'rules'
assert "Attendee is already checked in." in str(excinfo.value)
perform_checkin(position, clist, {}, type=Checkin.TYPE_EXIT)
assert OrderPosition.objects.filter(SQLLogic(clist).apply(clist.rules), pk=position.pk).exists()
perform_checkin(position, clist, {})
@pytest.mark.django_db
def test_rules_entries_since(event, position, clist):
# Ticket is valid once before X and once after X