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

CRM-21009 Only count line items with a quantity towards max capacity #10805

Merged
merged 1 commit into from
Oct 22, 2017

Conversation

JKingsnorth
Copy link
Contributor

@eileenmcnaughton
Copy link
Contributor

So, looking at this, that function is only called from one place -

Register::formatFieldsForOptionFull()
$recordedOptionsCount = CRM_Event_BAO_Participant::priceSetOptionsCount($form->_eventId, $skipParticipants);

& then that is used in
$dbTotalCount = CRM_Utils_Array::value($optId, $recordedOptionsCount, 0);

I'm feeling confused as to why the code is so complicated to get the total number of rows (& where the unit tests are!)

@JKingsnorth
Copy link
Contributor Author

JKingsnorth commented Aug 12, 2017 via email

@eileenmcnaughton
Copy link
Contributor

Right - we should ideally remove these 3 options from the function signature

$considerCounted = TRUE,
$considerWaiting = TRUE,
$considerTestParticipants = FALSE

As they are never passed in, and simplify the function

& presumably if we passed in an array of option ids then we could simply return an integer $count from the function & not create an array that needs to be iterated through to extract one value out of

@JKingsnorth
Copy link
Contributor Author

OK, sounds fair @eileenmcnaughton . We should also write a test! But can we do those things as a follow-up to this issue? I think it would be good to get this fixed. I'm happy to work on the follow-up, but it doesn't seem as urgent. Let me know if you feel otherwise and I'll try to set aside some time to work on it sooner.

@JKingsnorth
Copy link
Contributor Author

Jenkins retest this please

1 similar comment
@JKingsnorth
Copy link
Contributor Author

Jenkins retest this please

@eileenmcnaughton
Copy link
Contributor

@monishdeb based on my understanding of how you are dealing with changes in line items this seems relatively high priority now. I'm going to merge this since it was previously blocked on 'it would be nice if you did more' and it seems to have been held up in that stage for rather too long.

@eileenmcnaughton eileenmcnaughton merged commit bd16352 into civicrm:master Oct 22, 2017
@JKingsnorth
Copy link
Contributor Author

Thanks, I'll create the follow up issues to tackle when I can.

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

Successfully merging this pull request may close these issues.

3 participants