<commit_before><?php
namespace Acme\CoreBundle\Controller;

use Acme\BackendBundle\Entity\Constant;
use Acme\BackendBundle\Entity\RankLog;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Acme\CoreBundle\Model\InitializableControllerInterface;
use DateTime;
use Acme\BackendBundle\Entity\Rank;

class CustomerController extends Controller implements InitializableControllerInterface
{
    private $user;
    //private $company;

    public function initialize(Request $request/*, SecurityContextInterface $security_context*/)
    {
        //$this->user = $security_context->getToken()->getUser();
        //echo date('w');exit;
        //get rank week day
        $objORM = $this->getDoctrine()->getManager();
        $intRankWeekDay = $objORM->getRepository('AcmeBackendBundle:Basic')
            ->getRankWeekDay();
        //generate should_rank_log
        $timeNow = new \DateTime('now');
        $intWeek = date('w', $timeNow->getTimestamp());
        $floatShouldRank = $this->datediffInWeeks('5/10/2015', $timeNow->format('m/d/Y'));
        //get latest rank log
        $intCountRanked = $objORM->getRepository('AcmeBackendBundle:RankLog')
            ->getIntCountRanked();
        $intLatestTermNo = $objORM->getRepository('AcmeBackendBundle:RankLog')
            ->getIntLatestTermNo();
        $session = $request->getSession();
        $session->set('last_term_no', $intLatestTermNo);
        $session->set('current_term_no', $intLatestTermNo + 1);
        $session->set('rank_week_day', $intRankWeekDay);
        $intNextRankTime = $this->getIntNextRankTime($intRankWeekDay);
        $session->set('next_rank_time', $intNextRankTime);
        //if($intWeek >= $intRankWeekDay)
            //$floatShouldRank += 1;
        //if should_rank_log's count > rank_log's count
        //generate rank
        if($floatShouldRank > $intCountRanked){
            $this->generateRank($floatShouldRank - $intCountRanked, $intLatestTermNo);
            $this->initialize($request);
        }

    }
<commit_msg>log back to 1<commit_after><?php
namespace Acme\CoreBundle\Controller;

use Acme\BackendBundle\Entity\Constant;
use Acme\BackendBundle\Entity\RankLog;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Acme\CoreBundle\Model\InitializableControllerInterface;
use DateTime;
use Acme\BackendBundle\Entity\Rank;

class CustomerController extends Controller implements InitializableControllerInterface
{
    private $user;
    //private $company;

    public function initialize(Request $request/*, SecurityContextInterface $security_context*/)
    {
        //$this->user = $security_context->getToken()->getUser();
        //echo date('w');exit;
        //get rank week day
        $objORM = $this->getDoctrine()->getManager();
        $intRankWeekDay = $objORM->getRepository('AcmeBackendBundle:Basic')
            ->getRankWeekDay();
        //generate should_rank_log
        $timeNow = new \DateTime('now');
        $intWeek = date('w', $timeNow->getTimestamp());
        $floatShouldRank = $this->datediffInWeeks('5/10/2015', $timeNow->format('m/d/Y'));
        //get latest rank log
        $intCountRanked = $objORM->getRepository('AcmeBackendBundle:RankLog')
            ->getIntCountRanked();
        $intLatestTermNo = $objORM->getRepository('AcmeBackendBundle:RankLog')
            ->getIntLatestTermNo();
        var_dump($intLatestTermNo);
        $session = $request->getSession();
        $session->set('last_term_no', $intLatestTermNo);
        $session->set('current_term_no', $intLatestTermNo + 1);
        $session->set('rank_week_day', $intRankWeekDay);
        $intNextRankTime = $this->getIntNextRankTime($intRankWeekDay);
        $session->set('next_rank_time', $intNextRankTime);
        //if($intWeek >= $intRankWeekDay)
            //$floatShouldRank += 1;
        //if should_rank_log's count > rank_log's count
        //generate rank
        if($floatShouldRank > $intCountRanked){
            $this->generateRank($floatShouldRank - $intCountRanked, $intLatestTermNo);
            $this->initialize($request);
        }

    }

{'fraction_non_alphanumeric': 0.13577386468952735, 'fraction_numerical': 0.004402224281742354, 'mean_word_length': 3.4921956295525494, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 53, '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': '2398609', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1247, 'n_words': 202}