This commit is contained in:
2026-05-01 01:24:12 +03:00
parent 76ad37c1db
commit 2a73e46a7b

View File

@@ -377,10 +377,12 @@ def create_command():
# Assign position = one more than the current max for this town's pending build queue
if cmd_type == 'build':
pos_row = c.execute('''
SELECT MAX(position) as max_pos FROM commands
WHERE player_id = ? AND town_id = ? AND type = 'build' AND status IN (''pending'', ''executing'')
''', (str(data['player_id']), str(data['town_id']))).fetchone()
pos_row = c.execute(
"SELECT MAX(position) as max_pos FROM commands"
" WHERE player_id = ? AND town_id = ? AND type = 'build'"
" AND status IN ('pending', 'executing')",
(str(data['player_id']), str(data['town_id']))
).fetchone()
position = (pos_row['max_pos'] or 0) + 1
else:
position = None