Add smart cursor stuff
This commit is contained in:
13
src/main.py
13
src/main.py
@@ -1,7 +1,7 @@
|
||||
from flask import Flask, g, jsonify, request
|
||||
import sqlite3
|
||||
import game_tables
|
||||
import key_tables
|
||||
from key_tables import KeyService, KeyTable
|
||||
import container_managment
|
||||
|
||||
app = Flask(__name__)
|
||||
@@ -68,8 +68,9 @@ def get_table(table_id):
|
||||
def activate_table(table_id):
|
||||
db = get_db()
|
||||
cursor = db.cursor()
|
||||
keyService = KeyService(db)
|
||||
|
||||
keys = key_tables.get_free_keys(cursor)
|
||||
keys = keyService.get_free_keys(cursor)
|
||||
table = game_tables.read_by_id(table_id, cursor)
|
||||
|
||||
if table == None:
|
||||
@@ -83,9 +84,7 @@ def activate_table(table_id):
|
||||
|
||||
keys[0].reserve(table.game_table_id)
|
||||
table.active = True
|
||||
table.docker_id = container_managment.start_foundry_container(
|
||||
table
|
||||
)
|
||||
table.docker_id = container_managment.start_foundry_container(table)
|
||||
app.logger.info(table.docker_id)
|
||||
keys[0].commit(cursor)
|
||||
table.commit(cursor)
|
||||
@@ -98,8 +97,10 @@ def activate_table(table_id):
|
||||
def deactivate_table(table_id):
|
||||
db = get_db()
|
||||
cursor = db.cursor()
|
||||
keyService = KeyService(db)
|
||||
|
||||
table = game_tables.read_by_id(table_id, cursor)
|
||||
key = key_tables.get_key_for_table(table_id, cursor)
|
||||
key = keyService.get_key_for_table(table_id, cursor)
|
||||
|
||||
if table == None:
|
||||
return "No such table", 404
|
||||
|
||||
Reference in New Issue
Block a user