From 36e2d5adafdd2b95ca41b6a9c5355e13a9591828 Mon Sep 17 00:00:00 2001 From: furest Date: Wed, 22 Oct 2025 22:25:06 +0200 Subject: [PATCH 1/2] add support for hall positions --- lib/location.py | 9 ++++++--- lib/tables.py | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/location.py b/lib/location.py index b3723c7..33942f4 100644 --- a/lib/location.py +++ b/lib/location.py @@ -12,6 +12,8 @@ def even(x): def is_valid_seat(seat): return all (key in seat for key in ("row", "seat", "x1", "x2", "y1", "y2")) +def is_hall_position(seat): + return all (key in seat for key in ("hall", "type", "x", "y")) def get_hall_from_table_name(table): return re.search('([A-Za-z]+)[0-9]+', table).group(1) @@ -26,11 +28,12 @@ def normalize_table_name(table): def add_coordinates(seatmap, cursor): halls = {} tables = {} - # Currently we don't use the "hall" property of the seatmap but calculate - # our own grouping based on the initial non-numeric characters in the table - # name. That way we work around the human naming of halls. + halls_positions = {} for seat in seatmap: if not is_valid_seat(seat): + if is_hall_position(seat): + hall = seat['hall'] + cursor.execute("INSERT INTO hall_positions VALUES (?,?,?)", (seat['hall'], seat['x'], seat['y'])) continue table = normalize_table_name(seat['row']) logging.debug("Normalized table name %s to %s", seat['row'], table) diff --git a/lib/tables.py b/lib/tables.py index ed364dd..7394691 100644 --- a/lib/tables.py +++ b/lib/tables.py @@ -101,6 +101,12 @@ def create(conn): y INTEGER, table_name TEXT)''') + # Hall positions + c.execute('''CREATE TABLE hall_positions( + name TEXT, + x INTEGER, + y INTEGER)''') + # Meta data c.execute('''CREATE TABLE meta_data(name TEXT, value TEXT)''') From 01ac54a8e1570cdff1a674cd0dd68332e34c8ca8 Mon Sep 17 00:00:00 2001 From: furest Date: Sun, 26 Oct 2025 13:42:16 +0100 Subject: [PATCH 2/2] remove useless variable --- lib/location.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/location.py b/lib/location.py index 33942f4..42e76a9 100644 --- a/lib/location.py +++ b/lib/location.py @@ -28,7 +28,6 @@ def normalize_table_name(table): def add_coordinates(seatmap, cursor): halls = {} tables = {} - halls_positions = {} for seat in seatmap: if not is_valid_seat(seat): if is_hall_position(seat):