<commit_before><?php

namespace Lists\DepartmentBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * DepartmentPeopleMonthInfoRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class DepartmentPeopleMonthInfoRepository extends EntityRepository
{

    /**
     * @param integer $idDepartment
     * @param integer $month
     * @param integer $year
     * @param array   $filters
     *
     * @return \Doctrine\ORM\Query
     */
    public function getFilteredCoworkers($idDepartment, $month, $year, $filters = array())
    {
        $query = $this->createQueryBuilder('dpmi')
            ->select('dpmi.departmentPeopleId as id')
            ->addSelect('i.firstName')
            ->addSelect('i.lastName')
            ->addSelect('i.middleName')
            ->addSelect('dp.admissionDate')
            ->addSelect('dp.dismissalDate')
            ->addSelect('dp.admissionDateNotOfficially')
            ->addSelect('dp.dismissalDateNotOfficially')
            ->addSelect('dp.drfo')
            ->addSelect('i.address')
            ->addSelect('i.phone')
            ->addSelect('i.birthday')
            ->addSelect('i.passport')
            ->addSelect('m.name as mpkName')
            ->leftJoin('dpmi.departmentPeople', 'dp')
            ->leftJoin('dp.department', 'd')
            ->leftJoin('dp.individual', 'i')
            ->leftJoin('dp.mpks', 'm')
            ->where('d.id = :idDepartment')
            ->setParameter(':idDepartment', $idDepartment)
            ->andWhere('dpmi.year = :year')
            ->setParameter(':year', $year)
            ->andWhere('dpmi.month = :month')
            ->setParameter(':month', $month)
            //->groupBy('g.departmentPeopleId')
            ->getQuery();

        return $query;

    }
}<commit_msg>bug fixes with filters<commit_after><?php

namespace Lists\DepartmentBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * DepartmentPeopleMonthInfoRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class DepartmentPeopleMonthInfoRepository extends EntityRepository
{

    /**
     * @param integer $idDepartment
     * @param integer $month
     * @param integer $year
     * @param array   $filters
     *
     * @return \Doctrine\ORM\Query
     */
    public function getFilteredCoworkers($idDepartment, $month, $year, $filters = array())
    {
        $sql = $this->createQueryBuilder('dpmi')
            ->select('dpmi.departmentPeopleId as id')
            ->addSelect('i.firstName')
            ->addSelect('i.lastName')
            ->addSelect('i.middleName')
            ->addSelect('dp.admissionDate')
            ->addSelect('dp.dismissalDate')
            ->addSelect('dp.admissionDateNotOfficially')
            ->addSelect('dp.dismissalDateNotOfficially')
            ->addSelect('dp.drfo')
            ->addSelect('i.address')
            ->addSelect('i.phone')
            ->addSelect('i.birthday')
            ->addSelect('i.passport')
            ->addSelect('m.name as mpkName')
            ->leftJoin('dpmi.departmentPeople', 'dp')
            ->leftJoin('dp.department', 'd')
            ->leftJoin('dp.individual', 'i')
            ->leftJoin('dp.mpks', 'm')
            ->where('d.id = :idDepartment')
            ->setParameter(':idDepartment', $idDepartment)
            ->andWhere('dpmi.year = :year')
            ->setParameter(':year', $year)
            ->andWhere('dpmi.month = :month')
            ->setParameter(':month', $month);
            //->groupBy('g.departmentPeopleId')


            if (sizeof($filters)) {

                foreach ($filters as $key => $value) {
                    if (!$value) {
                        continue;
                    }
                    switch ($key) {
                        case 'mpk':
                            if (isset($value[0]) && !$value[0]) {
                                break;
                            }
                            $sql->andWhere('m.id in (:idsMpk)');
                            $sql->setParameter(':idsMpk', explode(',', $value));
                            break;
                        case 'coworker':
                            if (isset($value[0]) && !$value[0]) {
                                break;
                            }
                            $sql->andWhere('i.id  in (:idsUser)');
                            $sql->setParameter(':idsUser', explode(',', $value));
                            break;
                    }
                }
            }

        $query = $sql->getQuery();
        return $query;

    }
}
{'fraction_non_alphanumeric': 0.14702100300042864, 'fraction_numerical': 0.0008572653236176596, 'mean_word_length': 1.6622932116371933, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 62, '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': '7251735', 'n_tokens_mistral': 1318, 'n_tokens_neox': 1263, 'n_words': 222}