Files

25 lines
690 B
Python

from flask import Blueprint, render_template, request
from web.services.discovery_service import DiscoveryService
bp = Blueprint('discover', __name__, url_prefix='/discover')
@bp.route('/')
def index():
tone = request.args.get('tone')
dimension = request.args.get('dimension')
if dimension not in {'map', 'elo'}:
dimension = None
return render_template(
'discover/index.html',
insights=DiscoveryService.get_insights(tone),
medals=DiscoveryService.get_medals(dimension),
leaderboard=DiscoveryService.get_medal_leaderboard(),
tone=tone,
dimension=dimension,
tone_labels=DiscoveryService.TONE_LABELS,
)