Skip to content

Commit

Permalink
Compte épargne : corrige l'affichage sur la badgeuse (#991)
Browse files Browse the repository at this point in the history
* Badge: fix member counter & time count

* Replace membership with member
  • Loading branch information
raphodn authored Sep 13, 2023
1 parent 2352737 commit 7738b09
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/AppBundle/Controller/CardReaderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,31 @@ public function checkAction(Request $request)

// find corresponding beneficiary
$beneficiary = $card->getBeneficiary();
$membership = $beneficiary->getMembership();
$member = $beneficiary->getMembership();

// validate beneficiary ongoing shift(s)
$ongoingShifts = $em->getRepository('AppBundle:Shift')->getOngoingShifts($beneficiary);
$ongoingShiftsValidated = 0;
foreach ($ongoingShifts as $shift) {
if ($shift->getWasCarriedOut() == 0) {
$shift->validateShiftParticipation();
if ($ongoingShifts) {
foreach ($ongoingShifts as $shift) {
if ($shift->getWasCarriedOut() == 0) {
$shift->validateShiftParticipation();

$em->persist($shift);
$em->flush();
$em->persist($shift);
$em->flush();

$dispatcher = $this->get('event_dispatcher');
$dispatcher->dispatch(ShiftValidatedEvent::NAME, new ShiftValidatedEvent($shift));
$dispatcher = $this->get('event_dispatcher');
$dispatcher->dispatch(ShiftValidatedEvent::NAME, new ShiftValidatedEvent($shift));

$ongoingShiftsValidated += 1;
$ongoingShiftsValidated += 1;
}
}

$em->refresh($member); // added to prevent from returning cached (old) data
}

$cycle_end = $this->get('membership_service')->getEndOfCycle($membership, 0);
$counter = $membership->getShiftTimeCount($cycle_end);
$cycle_end = $this->get('membership_service')->getEndOfCycle($member, 0);
$counter = $member->getShiftTimeCount($cycle_end);
if ($this->swipeCardLogging) {
if ($this->swipeCardLoggingAnonymous) {
$card = null;
Expand Down

0 comments on commit 7738b09

Please sign in to comment.