wip: todo

This commit is contained in:
2023-09-29 15:51:03 +02:00
parent 2ca44516da
commit 9e92b8855d
2 changed files with 99 additions and 0 deletions

View File

@@ -204,6 +204,34 @@ class DataTable():
return self.__build(results, total, filtered)
def get_all_maps(self):
filtered = 0
total = 0
# base query
query = db.session.query(Map)
total = query.count()
if self.searchValue:
# search string (search for all substrings individually #
filterQuery = query
for substr in self.searchValue.split(" "):
searchSubstr = "%{}%".format(substr.strip())
filterQuery = filterQuery.filter(Map.mapname.like(searchSubstr))
filtered = filterQuery.count()
results = filterQuery.offset(self.start).limit(self.length).all()
else:
query = query.order_by(self.orderAscDbClassReverse(Map.mapname))
results = query.offset(self.start).limit(self.length).all()
filtered = total
return self.__build(results, total, filtered)
def replay_from_path(fullpath, uploader=None):
if not fullpath.endswith(".gbx"):
@@ -311,6 +339,14 @@ def source(map_uid):
jsonDict = dt.get(map_uid=map_uid)
return flask.Response(json.dumps(jsonDict), 200, mimetype='application/json')
@app.route("/data-source-index", methods=["POST"])
def index_source(map_uid):
cols = ["mapname", "personal_"]
dt = DataTable(flask.request.form.to_dict(), )
jsonDict = dt.get(map_uid=map_uid)
return flask.Response(json.dumps(jsonDict), 200, mimetype='application/json')
@app.route("/upload", methods = ['GET', 'POST'])
def upload():