添加选择baseline参数

This commit is contained in:
zhiyang7 2021-12-29 18:01:36 +08:00
parent 934a186987
commit 2898568579
1 changed files with 5 additions and 1 deletions

View File

@ -62,7 +62,11 @@ def charts():
@app.route('/metrics', methods=['GET']) @app.route('/metrics', methods=['GET'])
def metrics(): def metrics():
type = request.args.get('type') type = request.args.get('type')
baselines = Baseline.select().order_by(Baseline.rank.desc()).limit(3) baseline = request.args.get('baseline')
if baseline is None:
baselines = Baseline.select().order_by(Baseline.rank.desc()).limit(3)
else:
baselines = Baseline.select().where(Baseline.rank <= baseline).order_by(Baseline.rank.desc()).limit(3)
metrics = {} metrics = {}
for i in range(len(baselines)): for i in range(len(baselines)):
baseline = baselines[i] baseline = baselines[i]