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 : répare une erreur en début de cycle #990

Merged
merged 4 commits into from
Sep 22, 2023

Conversation

raphodn
Copy link
Member

@raphodn raphodn commented Sep 13, 2023

Quoi ?

Lors du début de cycle, createCycleBeginningLog est appelé.

Mais lors de notre calcul du compteur temps du membre, on passait un paramètre $date, ce qui avait pour conséquence de (parfois ?) ignorer le plus récent log de temps (celui de début de cycle).

@raphodn raphodn self-assigned this Sep 13, 2023
@raphodn raphodn changed the title Compte épargne : répare des erreurs en début de cycle Compte épargne : répare une erreur en début de cycle Sep 13, 2023
@@ -304,8 +304,8 @@ private function createCycleBeginningLog(Membership $member, \DateTime $date)

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

$member_counter_date = $member->getShiftTimeCount($date);
$extra_counter_time = $member_counter_date - ($this->due_duration_by_cycle + $this->max_time_at_end_of_shift);
$member_counter_now = $member->getShiftTimeCount();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

la ligne la plus importante de cette PR :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, y'a pas un effet de bord sur d'autres coop ici ?

Je m'explique : quand tu désactives l'option de valider les créneaux via la badgeuse, ils sont automatiquement validés à la date future du créneau. Si tu prends un créneau sur le cycle N+1, il ne faut pas qu'à la fin du cycle N, il soit pris en compte dans le calcul.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je vois... Peut-être remettre le paramètre $date du coup, mais on rajoutant 1 minute par exemple pour être sûr d'avoir le time count à jour ?

Copy link
Member Author

@raphodn raphodn Sep 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petitalb j'ai rebasé, et rajouté ce commit pour modifier légèrement la $date : 5b06140

image

@raphodn raphodn marked this pull request as draft September 13, 2023 16:18
@raphodn raphodn marked this pull request as ready for review September 18, 2023 15:31
@raphodn raphodn force-pushed the raphodn/time-log-saving-end-fix branch from 22b5b16 to c019338 Compare September 21, 2023 15:50
@raphodn raphodn force-pushed the raphodn/time-log-saving-end-fix branch from bf66f35 to 5b06140 Compare September 21, 2023 17:40
@raphodn raphodn merged commit f3f661a into master Sep 22, 2023
1 check failed
@raphodn raphodn deleted the raphodn/time-log-saving-end-fix branch September 22, 2023 07:17
OursDesCavernes pushed a commit to Les400Coop/gestion-compte that referenced this pull request Jan 20, 2024
…#990)

* OnCycleEnd: fix member saving time count calculation

* Fix calculation with extra_counter_time

* Modify a bit date to get full shiftTimeCount

* Small wording change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants