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

Booking : fix ne pas permettre de réserver des shifts déjà pris #717

Merged
merged 3 commits into from
Jan 26, 2023

Conversation

raphodn
Copy link
Member

@raphodn raphodn commented Jan 26, 2023

Quoi ?

Dans la fonction ShiftService.isShiftBookable() il n'y avait pas le cas où le shift avait déjà un "shifter", et donc n'est pas bookable.

En local j'avais des incohérences dû à cela

J'ai aussi fait quelques modifs de "cleanup" dans les templates

  • renommé availableShifts en bookableShifts
  • alignement

@raphodn raphodn changed the base branch from master to raphodn/book-shift-fixe January 26, 2023 11:00
@raphodn raphodn requested review from petitalb and symartin January 26, 2023 11:00
@raphodn raphodn self-assigned this Jan 26, 2023
@@ -193,42 +193,42 @@ public function getBeneficiariesWhoCanBookForCycle(Membership $member, $cycle =

public function isShiftBookable(Shift $shift, Beneficiary $beneficiary = null)
{
// Do not book old or locked shifts
if ($shift->getIsPast() || $shift->isLocked()) {
if (!$beneficiary) {
Copy link
Member Author

@raphodn raphodn Jan 26, 2023

Choose a reason for hiding this comment

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

pour le if !beneficiary, dans quel cas ca pourrait se produire en fait ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Si un salarié utilise le lien direct pour réserver un créneau (oui, c'est un peu tordu car il n'a pas le lien dans sa vue)

Base automatically changed from raphodn/book-shift-fixe to master January 26, 2023 12:35
@raphodn raphodn force-pushed the raphodn/book-shift-rules branch from fb91f92 to 9ab8ddb Compare January 26, 2023 12:35
<div style="height:2px; width: 100%;position: absolute;top:-2px;">
{% if nbBookableShifts < nbShifts %}
{% for shifter in 1..(nbShifts - nbBookableShifts) %}
{% if nbBookedShifts %}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Un peu ambigue en condition ?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes t'as raison j'ai rajouté un commit : e7cde22

}

// Do not book old or locked or booked shifts
if ($shift->getIsPast() || $shift->isLocked() || $shift->getShifter()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Attention, tu es sur pour le $shift->getShifter() ?

Je me demande si on n'appelle pas cette methode avec un shift mais ca pourrait aussi concerner un bucket ?

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 viens de re-vérifier, c'est toujours un $shift qui est le premier paramètre lorsque la fonction isShiftBookable() est appelée. mais ca me parait bizarre en effet que ca n'ait pas été fix plus tôt

@raphodn raphodn merged commit d4084e9 into master Jan 26, 2023
@raphodn raphodn deleted the raphodn/book-shift-rules branch January 26, 2023 22:06
quot17 pushed a commit to quot17/gestion-compte that referenced this pull request Mar 28, 2023
…an-grenoble#717)

* Add rule in isShiftBookable (shift must not be already booked)

* Cleanup templates, clarify
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