@app.route("/rating-by-operator", methods=['GET'])
def rating_by_operator():
operators = [r[0] for r in db.session.query(Rating.operator).distinct().all()]
rating_by_operators = []
for index, operator in enumerate(operators):
rat = Rating()
rat.id = index
rat.operator = operator
rat.labels = [r[0].strftime("%m-%d %H:%M") for r in db.session.query(Rating).filter_by(operator=operator).values('created_at')]
rat.values = [r[0] for r in db.session.query(Rating).filter_by(operator=operator).values('value')]
rating_by_operators.append(rat)
return render_template('rating_by_operator.html', ratings=rating_by_operators)