mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
default to non-race api generation
This commit is contained in:
@@ -61,9 +61,13 @@ def generate_api():
|
|||||||
options = get_yaml_data(file)
|
options = get_yaml_data(file)
|
||||||
|
|
||||||
json_data = request.get_json()
|
json_data = request.get_json()
|
||||||
if 'weights' in json_data:
|
race = False
|
||||||
# example: options = {"player1weights" : {<weightsdata>}}
|
if json_data:
|
||||||
options = json_data["weights"]
|
if 'weights' in json_data:
|
||||||
|
# example: options = {"player1weights" : {<weightsdata>}}
|
||||||
|
options = json_data["weights"]
|
||||||
|
if "race" in json_data:
|
||||||
|
race = bool(json_data["race"])
|
||||||
if not options:
|
if not options:
|
||||||
return {"text": "No options found. Expected file attachment or json weights."
|
return {"text": "No options found. Expected file attachment or json weights."
|
||||||
}, 400
|
}, 400
|
||||||
@@ -72,7 +76,6 @@ def generate_api():
|
|||||||
return {"text": "Max size of multiworld exceeded",
|
return {"text": "Max size of multiworld exceeded",
|
||||||
"detail": app.config["MAX_ROLL"]}, 409
|
"detail": app.config["MAX_ROLL"]}, 409
|
||||||
|
|
||||||
race = bool(json_data["race"])
|
|
||||||
results, gen_options = roll_options(options)
|
results, gen_options = roll_options(options)
|
||||||
if any(type(result) == str for result in results.values()):
|
if any(type(result) == str for result in results.values()):
|
||||||
return {"text": str(results),
|
return {"text": str(results),
|
||||||
|
Reference in New Issue
Block a user