<commit_before><?php
/**
 * Created by PhpStorm.
 * User: stas
 * Date: 01.05.16
 * Time: 21:20
 */

namespace CoreBundle\Service;

use CoreBundle\Model\Game\GameStatus;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

/**
 * Class UserStatService
 * @package CoreBundle\Service
 */
class UserStatService
{
    use ContainerAwareTrait;
    
    public function run()
    {
        $users = $this->container->get("doctrine")->getRepository("CoreBundle:User")->findAll();
        
        $win = $draw = $lose = 0;
        
        foreach ($users as $user) {
            $games = $this->container->get("core.handler.game")->getGamesForUser($user, GameStatus::END);
            
            foreach ($games as $game) {
                if (strlen($game->getPgn() < 20)) {
                    continue;
                }
                
                if ($game->getUserWhite() == $user) {
                    switch ($game->getResultWhite()) {
                        case 1:
                            $win++;
                            break;
                        case 0.5:
                            $draw++;
                            break;<commit_msg>chore(user-stat): Fix user stat command.<commit_after><?php
/**
 * Created by PhpStorm.
 * User: stas
 * Date: 01.05.16
 * Time: 21:20
 */

namespace CoreBundle\Service;

use CoreBundle\Model\Game\GameStatus;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;

/**
 * Class UserStatService
 * @package CoreBundle\Service
 */
class UserStatService
{
    use ContainerAwareTrait;
    
    public function run()
    {
        $users = $this->container->get("doctrine")->getRepository("CoreBundle:User")->findAll();
        
        $win = $draw = $lose = 0;
        
        foreach ($users as $user) {
            $games = $this->container->get("core.handler.game")->getGamesForUser($user, GameStatus::END);
            
            foreach ($games as $game) {
                if (strlen($game->getPgn()) < 20) {
                    continue;
                }
                
                if ($game->getUserWhite() == $user) {
                    switch ($game->getResultWhite()) {
                        case 1:
                            $win++;
                            break;
                        case 0.5:
                            $draw++;
                            break;
{'fraction_non_alphanumeric': 0.1296684851028116, 'fraction_numerical': 0.013428451531682753, 'mean_word_length': 1.4401228249744114, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, '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': '358299', 'n_tokens_mistral': 679, 'n_tokens_neox': 639, 'n_words': 125}