Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compte épargne : corrige l'affichage sur la badgeuse #991

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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