<commit_before>from datetime import date
from collections import defaultdict
import logging
import flask
from flask.ext.script import Manager
from flask.ext.rq import job
from mptracker import models


logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

votes_manager = Manager()

votes = flask.Blueprint('votes', __name__)


@votes.route('/votes/')
def index():
    voting_sessions = (
        models.VotingSession.query
            .order_by(
                models.VotingSession.date.desc(),
                models.VotingSession.cdeppk.desc(),
            ))
    return flask.render_template('votes/index.html', **{
        'voting_sessions': iter(voting_sessions),
    })


@votes.route('/votes/<uuid:voting_session_id>')
def detail(voting_session_id):
    voting_session = models.VotingSession.query.get_or_404(voting_session_id)
    votes = (
        voting_session.votes
            .join(models.Vote.mandate)
            .join(models.Mandate.person)
            .join(models.Mandate.county)
            .join(models.Mandate.group_memberships)
            .join(models.MpGroupMembership.mp_group))<commit_msg>order vote list by MP name<commit_after>from datetime import date
from collections import defaultdict
import logging
import flask
from flask.ext.script import Manager
from flask.ext.rq import job
from mptracker import models


logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

votes_manager = Manager()

votes = flask.Blueprint('votes', __name__)


@votes.route('/votes/')
def index():
    voting_sessions = (
        models.VotingSession.query
            .order_by(
                models.VotingSession.date.desc(),
                models.VotingSession.cdeppk.desc(),
            ))
    return flask.render_template('votes/index.html', **{
        'voting_sessions': iter(voting_sessions),
    })


@votes.route('/votes/<uuid:voting_session_id>')
def detail(voting_session_id):
    voting_session = models.VotingSession.query.get_or_404(voting_session_id)
    votes = (
        voting_session.votes
        .join(models.Vote.mandate)
        .join(models.Mandate.person)
        .join(models.Mandate.county)
        .join(models.Mandate.group_memberships)
        .join(models.MpGroupMembership.mp_group)
        .order_by(models.Person.name)
    )
{'fraction_non_alphanumeric': 0.1091304347826087, 'fraction_numerical': 0.0026086956521739132, 'mean_word_length': 3.1016042780748663, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2596487', 'n_tokens_mistral': 746, 'n_tokens_neox': 727, 'n_words': 117}