<commit_before><?php

class RankingController extends BaseController
{

    public function showRanking($group = null)
    {
        $conn = DB::connection('stats');

        $query = DailyAction::select(DB::raw('user_id, Sum(points) as points, Sum(contents) as contents,
                Sum(comments) as comments, Sum(entries) as entries, Sum(uv) as uv, Sum(dv) as dv'))
            ->with(['user' => function($q) { $q->select(['name', 'avatar']); }])
            ->groupBy('user_id')
            ->orderBy('points', 'desc');

        if ($group)
        {
            $group = Group::where('shadow_urlname', shadow($group))->firstOrFail();
            $query->where('group_id', $group->_id);

            $data['group'] = $group;
        }

        if (Input::has('user'))
        {
            $user = User::where('shadow_name', Str::lower(Input::get('user')))->firstOrFail();
        }

        // Time filter
        if (Input::get('time'))
        {
            $timestamp = Carbon::now(Input::get('time'))->subDay()->minute(0)->second(0);
            $query->where('created_at', '>', carbon_to_md($timestamp));
        }

        $data['users'] = $query->paginate(50);

        return View::make('ranking.ranking', $data);
    }

    public function getIndex()
    {
        $conn = DB::connection('stats');

        $query = DailyAction::select(DB::raw('user_id, Sum(points) as points, Sum(contents) as contents,
                Sum(comments) as comments, Sum(entries) as entries, Sum(uv) as uv, Sum(dv) as dv'))
            ->with('user')
            ->groupBy('user_id')
            ->orderBy('points', 'desc');

        if (Input::has('group'))
        {
            $group = Group::where('shadow_urlname', Str::lower(Input::get('group')))->firstOrFail();
            $query->where('group_id', $group->_id);

            $data['group'] = $group;
        }

        // Time filter
        if (Input::get('time'))
        {
            $timestamp = Carbon::now(Input::get('time'))->subDay()->minute(0)->second(0);
            $query->where('created_at', '>', carbon_to_md($timestamp));
        }

        return $query->paginate(50);
    }

}<commit_msg>Fix time filter in ranking<commit_after><?php

class RankingController extends BaseController
{

    public function showRanking($group = null)
    {
        $conn = DB::connection('stats');

        $query = DailyAction::select(DB::raw('user_id, Sum(points) as points, Sum(contents) as contents,
                Sum(comments) as comments, Sum(entries) as entries, Sum(uv) as uv, Sum(dv) as dv'))
            ->with(['user' => function($q) { $q->select(['name', 'avatar']); }])
            ->groupBy('user_id')
            ->orderBy('points', 'desc');

        if ($group)
        {
            $group = Group::where('shadow_urlname', shadow($group))->firstOrFail();
            $query->where('group_id', $group->_id);

            $data['group'] = $group;
        }

        if (Input::has('user'))
        {
            $user = User::where('shadow_name', Str::lower(Input::get('user')))->firstOrFail();
        }

        $data['users'] = $query->paginate(50);

        return View::make('ranking.ranking', $data);
    }

    public function getIndex()
    {
        $conn = DB::connection('stats');

        $query = DailyAction::select(DB::raw('user_id, Sum(points) as points, Sum(contents) as contents,
                Sum(comments) as comments, Sum(entries) as entries, Sum(uv) as uv, Sum(dv) as dv'))
            ->with('user')
            ->groupBy('user_id')
            ->orderBy('points', 'desc');

        if (Input::has('group'))
        {
            $group = Group::where('shadow_urlname', Str::lower(Input::get('group')))->firstOrFail();
            $query->where('group_id', $group->_id);

            $data['group'] = $group;
        }

        // Time filter
        if (Input::has('time'))
        {
            $fromDay = Carbon::now()->diffInDays(Carbon::create(2013, 1, 1)) - Input::get('time');
            $query->where('day', '>', $fromDay);
        }

        return $query->paginate(50);
    }

}
{'fraction_non_alphanumeric': 0.1942745289943724, 'fraction_numerical': 0.004404208465867384, 'mean_word_length': 2.3453355155482813, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 50, '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': '2871906', 'n_tokens_mistral': 1255, 'n_tokens_neox': 1206, 'n_words': 225}