Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/import-2024' into preprod
Browse files Browse the repository at this point in the history
  • Loading branch information
BenoitLeveque committed Aug 24, 2024
2 parents e6c4dc9 + 64dca55 commit f3d3ac7
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Campaign/Format/FormatFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function createFromCode($code)
{
$class = '\App\Campaign\Format\Formats\Format'.$code;
if (!class_exists($class)) {
throw new \InvalidArgumentException(sprintf('Code %s invalid', $code));
throw new \InvalidArgumentException(\sprintf('Code %s invalid', $code));
}

return new $class();
Expand Down
9 changes: 9 additions & 0 deletions src/Campaign/Format/Formats/Format2024.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace App\Campaign\Format\Formats;

class Format2024 extends Format2023
{
}
2 changes: 1 addition & 1 deletion src/Enums/EnumsCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function __construct(iterable $enums = [])
public function getEnums($alias): EnumsInterface
{
if (!isset($this->enums[$alias])) {
throw new \InvalidArgumentException(sprintf('Enums %s inconnu', $alias));
throw new \InvalidArgumentException(\sprintf('Enums %s inconnu', $alias));
}

return $this->enums[$alias];
Expand Down
23 changes: 15 additions & 8 deletions src/Enums/JobTitleEnums.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,24 @@ class JobTitleEnums extends AbstractEnums
public const SYSADMIN = 9;
public const DEVOPS = 10;

public const DEV_JUNIOR = 11;
public const DEV_CONFIRME = 12;
public const DEV_SENIOR = 13;
public const DEV_EXPERT = 14;
public const TECH_LEAD = 15;

protected array $choices = [
self::DIRECTEUR => 'Directeur et Directrice, cadre dirigeant',
self::RESPONSABLE_EQUIPE => "Cadre intermédiaire, responsable d'équipe",
self::CHEF_PROJET => 'Chef/Cheffe de projet',
self::LEAD_DEVELOPPEUR => 'Lead développeur/Lead développeuse',
self::DEV_JUNIOR => 'Développeuse / Développeur Junior',
self::DEV_CONFIRME => 'Développeuse / Développeur confirmé',
self::DEV_SENIOR => 'Développeuse / Développeur Senior',
self::DEV_EXPERT => 'Développeuse / Développeur Expert',
self::TECH_LEAD => 'Tech Lead',
self::RESPONSABLE_EQUIPE => "Responsable d'équipe",
self::CONSULTANT => 'Consultante / Consultant',
self::ARCHITECTE => 'Architecte',
self::CONSULTANT => 'Consultant',
self::FORMATEUR => 'Formateur/Formatrice',
self::DEVELOPPEUR => 'Développeur/Développeuse',
self::SYSADMIN => 'Sysadmin',
self::DEVOPS => 'Devops',
self::CHEF_PROJET => 'Chef/Cheffe de projet',
self::FORMATEUR => 'Formatrice / Formateur',
self::AUTRE => 'Autre',
];

Expand Down
4 changes: 4 additions & 0 deletions src/Enums/StatusEnums.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ class StatusEnums extends AbstractEnums
public const CDI = 2;
public const FREELANCE = 3;
public const SANS_EMPLOI = 4;
public const ALTERNANCE = 5;
public const FONCTIONNAIRE = 6;

protected array $choices = [
self::CDD => 'Contrat à durée déterminée',
self::CDI => 'Contrat à durée indéterminée',
self::FREELANCE => 'Freelance / entreprise individuelle',
self::ALTERNANCE => 'Alternance / contrat pro / apprentissage',
self::FONCTIONNAIRE => 'Fonctionnaire',
self::SANS_EMPLOI => 'Sans emploi',
self::AUTRE => 'Autre',
];
Expand Down
2 changes: 1 addition & 1 deletion src/Filter/DepartmentFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ protected function getChoices()
$choices[self::ALL_BUT_PARIS] = 'Tous sauf île-de-France';

foreach (new Departments() as $number => $label) {
$choices[$number] = sprintf('%s - %s', $number, $label);
$choices[$number] = \sprintf('%s - %s', $number, $label);
}

return $choices;
Expand Down
2 changes: 1 addition & 1 deletion src/Filter/DistrictFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function getChoices()
$choices = [];

foreach (new Regions() as $number => $label) {
$choices[$number] = sprintf('%s - %s', $number, $label->getLabel());
$choices[$number] = \sprintf('%s - %s', $number, $label->getLabel());
}

return $choices;
Expand Down
27 changes: 26 additions & 1 deletion src/Filter/JobTitleFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,32 @@ public function buildQuery(QueryBuilder $queryBuilder, array $values = [])
return;
}

$queryBuilder->andWhere($queryBuilder->expr()->in('response.jobTitle', $values[$this->getName()]));
$filterValue = $values[$this->getName()];

$filterValue = $this->supportOldValues($filterValue);

$queryBuilder->andWhere($queryBuilder->expr()->in('response.jobTitle', $filterValue));
}

private function supportOldValues(array $values): array
{
$mapping = [
JobTitleEnums::DEV_JUNIOR,
JobTitleEnums::DEV_CONFIRME,
JobTitleEnums::DEV_SENIOR,
JobTitleEnums::DEV_EXPERT,
];

$oldTitle = [
JobTitleEnums::DEVELOPPEUR,
JobTitleEnums::LEAD_DEVELOPPEUR,
];

if ([] !== array_intersect($values, $mapping)) {
$values = array_merge($values, $oldTitle);
}

return $values;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Query/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function __construct(Connection $connection)
*/
public function createTemporaryTable($tablename)
{
$sql = sprintf('CREATE TEMPORARY TABLE `%s` %s', $tablename, $this->getSQL());
$sql = \sprintf('CREATE TEMPORARY TABLE `%s` %s', $tablename, $this->getSQL());

$this->connection->executeStatement($sql, $this->getParameters(), $this->paramTypes);
}
Expand All @@ -40,7 +40,7 @@ public function createTemporaryTable($tablename)
*/
public function dropTemporaryTable($tablename)
{
$sql = sprintf('DROP TEMPORARY TABLE IF EXISTS `%s`', $tablename);
$sql = \sprintf('DROP TEMPORARY TABLE IF EXISTS `%s`', $tablename);

$this->connection->executeStatement($sql);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Report/SalaryReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SalaryReport extends AbstractReport
public function execute()
{
$this->queryBuilder->select('count(distinct response.id) as nbResponse');
$this->queryBuilder->addSelect(sprintf('ROUND(response.grossAnnualSalary / %s) as salarySlice', self::SLICE));
$this->queryBuilder->addSelect(\sprintf('ROUND(response.grossAnnualSalary / %s) as salarySlice', self::SLICE));
$this->queryBuilder->having('nbResponse >= :minResult');
$this->queryBuilder->setParameter('minResult', $this->minResult);
$this->queryBuilder->addGroupBy('salarySlice');
Expand Down
2 changes: 1 addition & 1 deletion src/ReportManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public function createBaseQueryBuilder()

$this->filterCollection->buildQuery($filterTableBuilder, $data);

$temporaryTablename = sprintf('tmp_%s', md5(serialize($data)));
$temporaryTablename = \sprintf('tmp_%s', md5(serialize($data)));
$filterTableBuilder->dropTemporaryTable($temporaryTablename);
$filterTableBuilder->createTemporaryTable($temporaryTablename);

Expand Down

0 comments on commit f3d3ac7

Please sign in to comment.