<commit_before><?php
namespace LVAC\Race;

use Silex\Application;
use Silex\ControllerProviderInterface;
use \Carbon\Carbon as c;

class ControllerProvider implements ControllerProviderInterface
{
    public function connect(Application $app)
    {
        $controllers = $app['controllers_factory'];

        $controllers->get('/', function () use ($app) {
            $mapper = new \LVAC\Race\Mapper($app['db']);
            $allResults = $mapper->getResults(5);
            $results = $mapper->groupByYear($allResults);
            $races = $mapper->getFutureRaces(5);
            return $app['twig']->render('races/index.html', array('results' => $results, 'races' => $races));
        });

        $controllers->get('/{slug}', function (Application $app, $slug) {
            $mapper = new \LVAC\Race\Mapper($app['db']);
            $race = $mapper->getRaceBySlug($slug);

            if ($race->getDate() < c::today()) {
                $mapper = new \LVAC\Result\Mapper($app['db']);
                $results = $mapper->getResultsOfRace($race->getId());
                return $app['twig']->render('races/result.html', array('race' => $race, 'results' => $results));
            }
            return $app['twig']->render('races/race.html', array('race' => $race));
        });<commit_msg>Increases the list of races and results from 5 to 10<commit_after><?php
namespace LVAC\Race;

use Silex\Application;
use Silex\ControllerProviderInterface;
use \Carbon\Carbon as c;

class ControllerProvider implements ControllerProviderInterface
{
    public function connect(Application $app)
    {
        $controllers = $app['controllers_factory'];

        $controllers->get('/', function () use ($app) {
            $mapper = new \LVAC\Race\Mapper($app['db']);
            $allResults = $mapper->getResults();
            $results = $mapper->groupByYear($allResults);
            $races = $mapper->getFutureRaces();
            return $app['twig']->render('races/index.html', array('results' => $results, 'races' => $races));
        });

        $controllers->get('/{slug}', function (Application $app, $slug) {
            $mapper = new \LVAC\Race\Mapper($app['db']);
            $race = $mapper->getRaceBySlug($slug);

            if ($race->getDate() < c::today()) {
                $mapper = new \LVAC\Result\Mapper($app['db']);
                $results = $mapper->getResultsOfRace($race->getId());
                return $app['twig']->render('races/result.html', array('race' => $race, 'results' => $results));
            }
            return $app['twig']->render('races/race.html', array('race' => $race));
        });
{'fraction_non_alphanumeric': 0.18361904761904763, 'fraction_numerical': 0.0019047619047619048, 'mean_word_length': 2.735419630156472, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 37, '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': '2863473', 'n_tokens_mistral': 824, 'n_tokens_neox': 793, 'n_words': 146}