Skip to content

Commit

Permalink
[AdherentTags] keep last 6months event tags (#11462)
Browse files Browse the repository at this point in the history
  • Loading branch information
ottaviano committed Feb 12, 2025
1 parent 09b72db commit 38e9e81
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 61 deletions.
4 changes: 1 addition & 3 deletions features/api/adherent_messages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,7 @@ Feature:
"favorite": true,
"choices": {
"national_event:event-national-1": "Event National 1",
"national_event:event-national-2": "Event National 2",
"procuration:mandant": "Mandant",
"procuration:mandataire": "Mandataire"
"national_event:event-national-2": "Event National 2"
}
},
"type": "select"
Expand Down
4 changes: 1 addition & 3 deletions features/api/adherents.feature
Original file line number Diff line number Diff line change
Expand Up @@ -868,9 +868,7 @@ Feature:
"favorite": true,
"choices": {
"national_event:event-national-1": "Event National 1",
"national_event:event-national-2": "Event National 2",
"procuration:mandant": "Mandant",
"procuration:mandataire": "Mandataire"
"national_event:event-national-2": "Event National 2"
}
},
"type": "select"
Expand Down
4 changes: 1 addition & 3 deletions features/api/elected_representatives.feature
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,7 @@ Feature:
"favorite": true,
"choices": {
"national_event:event-national-1": "Event National 1",
"national_event:event-national-2": "Event National 2",
"procuration:mandant": "Mandant",
"procuration:mandataire": "Mandataire"
"national_event:event-national-2": "Event National 2"
}
},
"type": "select"
Expand Down
2 changes: 1 addition & 1 deletion src/Adherent/Tag/StaticTag/TagBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function __construct(
public function buildAll(): array
{
return array_merge(
array_map([$this, 'buildForEvent'], $this->nationalEventRepository->findAll()),
array_map([$this, 'buildForEvent'], $this->nationalEventRepository->findAllSince(new \DateTime('-6 months'))),
array_map(fn (AdherentStaticLabel $label) => $label->getIdentifier(), $this->staticLabelRepository->findAllLikeAdherentTags()),
);
}
Expand Down
12 changes: 0 additions & 12 deletions src/Adherent/Tag/TagEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ class TagEnum extends Enum
public const NATIONAL_EVENT = 'national_event';
public const NATIONAL_EVENT_PATTERN = self::NATIONAL_EVENT.':%s';

public const PROCURATION = 'procuration';
public const PROCURATION_PROXY = self::PROCURATION.':mandataire';
public const PROCURATION_REQUEST = self::PROCURATION.':mandant';

public static function getAdherentTags(bool $adherentOnly = false): array
{
$currentYear = date('Y');
Expand Down Expand Up @@ -86,14 +82,6 @@ public static function getElectTags(): array
];
}

public static function getStaticTags(): array
{
return [
self::PROCURATION_REQUEST,
self::PROCURATION_PROXY,
];
}

public static function getAdherentYearTag(?int $year = null, ?string $tag = null): string
{
$currentYear = date('Y');
Expand Down
32 changes: 0 additions & 32 deletions src/Adherent/Tag/TagGenerator/ProcurationTagGenerator.php

This file was deleted.

3 changes: 1 addition & 2 deletions src/Admin/Filter/StaticAdherentTagFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Admin\Filter;

use App\Adherent\Tag\StaticTag\TagBuilder;
use App\Adherent\Tag\TagEnum;
use Symfony\Contracts\Service\Attribute\Required;

class StaticAdherentTagFilter extends AdherentTagFilter
Expand All @@ -18,6 +17,6 @@ public function setTagBuilder(TagBuilder $eventTagBuilder): void

protected function getTags(): array
{
return array_merge($this->tagBuilder->buildAll(), TagEnum::getStaticTags());
return $this->tagBuilder->buildAll();
}
}
3 changes: 1 addition & 2 deletions src/JMEFilter/FilterBuilder/StaticTagsFilterBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\JMEFilter\FilterBuilder;

use App\Adherent\Tag\StaticTag\TagBuilder;
use App\Adherent\Tag\TagEnum;
use App\Adherent\Tag\TagTranslator;
use App\JMEFilter\FilterGroup\MilitantFilterGroup;

Expand All @@ -16,7 +15,7 @@ public function __construct(TagTranslator $translator, private readonly TagBuild

protected function init(): void
{
$this->tags = array_merge($this->eventTagBuilder->buildAll(), TagEnum::getStaticTags());
$this->tags = $this->eventTagBuilder->buildAll();

$this->fieldName = 'static_tags';
$this->fieldLabel = 'Labels divers';
Expand Down
2 changes: 2 additions & 0 deletions src/Repository/NationalEvent/EventInscriptionRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public function findAllByAdherent(Adherent $adherent): array
->addSelect('e')
->innerJoin('ei.event', 'e')
->where('ei.adherent = :adherent')
->andWhere('e.startDate >= :start_date')
->setParameter('adherent', $adherent)
->setParameter('start_date', new \DateTime('-6 months'))
->getQuery()
->getResult()
;
Expand Down
10 changes: 10 additions & 0 deletions src/Repository/NationalEvent/NationalEventRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,14 @@ public function findOneBySlug(string $part): ?NationalEvent
{
return $this->findOneBy(['slug' => $part]);
}

public function findAllSince(\DateTime $since): array
{
return $this->createQueryBuilder('event')
->where('event.startDate >= :start_date')
->setParameter('start_date', $since)
->getQuery()
->getResult()
;
}
}
3 changes: 0 additions & 3 deletions translations/messages+intl-icu.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1236,9 +1236,6 @@ adherent.tag.exempte: Exempté de cotisation
adherent.tag.cotisation_nok: Non à jour de cotisation
adherent.tag.exempte_et_adherent_cotisation_nok: Exempté mais pas à jour de cotisation adhérent
adherent.tag.national_event: Événement national
adherent.tag.procuration: Procuration
adherent.tag.mandant: Mandant
adherent.tag.mandataire: Mandataire

adhesion.physical_person.label: Je certifie sur l’honneur être une personne physique d’au moins 16 ans et que le règlement de ma cotisation ne provient pas du compte d’une personne morale (entreprise, association, collectivité...) mais bien de mon compte bancaire personnel.<br/><br/>Je certifie être de nationalité française ou résident fiscal Français.<br/><br/>J’adhère aux <a href="https://app.parti-renaissance.fr/assets/static/Statuts-Renaissance.pdf" class="text-ui_blue-50">Statuts</a> et au <a href="https://app.parti-renaissance.fr/assets/corpus-des-valeurs-parti-renaissance.pdf" class="text-ui_blue-50">Corpus des valeurs</a> de Renaissance.<br/><br/>J’accepte les <a href="https://parti-renaissance.fr/cgu" class="text-ui_blue-50">CGU du site</a> Renaissance et déclare avoir lu la <a href="https://parti-renaissance.fr/politique-de-protection-des-donnees" class="text-ui_blue-50">Politique de protection des données personnelles</a> et les mentions d’information relatives au traitement de mes données ci-dessous.

Expand Down

0 comments on commit 38e9e81

Please sign in to comment.