<commit_before><?php

namespace Mongoeat\Bundle\VoteBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Decision
 *
 * @ORM\Table(name="mongoeat_decision")
 * @ORM\Entity(repositoryClass="Mongoeat\Bundle\VoteBundle\Entity\DecisionRepository")
 */
class Decision
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date", type="date")
     */
    private $date;

    /**
     * @ORM\ManyToOne(targetEntity="\Mongobox\Bundle\GroupBundle\Entity\Group", inversedBy="decisions")
     * @ORM\JoinColumn(name="group_id", referencedColumnName="id")
     */
    private $group;

    /**
     * @ORM\OneToMany(targetEntity="Mongoeat\Bundle\VoteBundle\Entity\Vote", mappedBy="decision", cascade={"persist"})
     */
    private $votes;

    public function getNombrePersonne()
    {
        return count($this->group->getUsers());
    }

    public function getRestaurentTop($pos)
    {
        $rest = array();
        foreach ($this->votes as $vote) {
            $rest[] = $vote->getRestaurant()->getName();
        }
        $res = array_count_values($rest);
        asort($res,SORT_NUMERIC);
        for ($i=1;$i<$pos && current($res) !== FALSE;$i++) {
            next($res);
        }
        if ($i == $pos && current($res) !== FALSE) {
            return key($res);
        } else

            return;
    }

    public function getRestaurentScore()
    {
        $rest = array();
        foreach ($this->votes as $vote) {
            $rest[] = $vote->getRestaurant()->getName();
        }
        $res = array_count_values($rest);
        asort($res,SORT_NUMERIC);

        return $res;
    }
    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;<commit_msg>Tentative de bon tri des restaurants sur mongoeat<commit_after><?php

namespace Mongoeat\Bundle\VoteBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Decision
 *
 * @ORM\Table(name="mongoeat_decision")
 * @ORM\Entity(repositoryClass="Mongoeat\Bundle\VoteBundle\Entity\DecisionRepository")
 */
class Decision
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="date", type="date")
     */
    private $date;

    /**
     * @ORM\ManyToOne(targetEntity="\Mongobox\Bundle\GroupBundle\Entity\Group", inversedBy="decisions")
     * @ORM\JoinColumn(name="group_id", referencedColumnName="id")
     */
    private $group;

    /**
     * @ORM\OneToMany(targetEntity="Mongoeat\Bundle\VoteBundle\Entity\Vote", mappedBy="decision", cascade={"persist"})
     */
    private $votes;

    public function getNombrePersonne()
    {
        return count($this->group->getUsers());
    }

    public function getRestaurentTop($pos)
    {
        $rest = array();
        foreach ($this->votes as $vote) {
            $rest[] = $vote->getRestaurant()->getName();
        }
        $res = array_count_values($rest);
        arsort($res,SORT_NUMERIC);
        for ($i=1;$i<$pos && current($res) !== FALSE;$i++) {
            next($res);
        }
        if ($i == $pos && current($res) !== FALSE) {
            return key($res);
        } else

            return;
    }

    public function getRestaurentScore()
    {
        $rest = array();
        foreach ($this->votes as $vote) {
            $rest[] = $vote->getRestaurant()->getName();
        }
        $res = array_count_values($rest);
        arsort($res,SORT_NUMERIC);

        return $res;
    }
    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
{'fraction_non_alphanumeric': 0.16883116883116883, 'fraction_numerical': 0.0005194805194805195, 'mean_word_length': 2.258037225042301, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 21, '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': '4549291', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1236, 'n_words': 196}