Make sure the randomly selected provider is really serving the selected service, when generating availability wit the "Any Provider" option in the frontend (#991).
This commit is contained in:
parent
120421b3af
commit
af350fc617
1 changed files with 6 additions and 1 deletions
|
@ -75,7 +75,12 @@ window.FrontendBookApi = window.FrontendBookApi || {};
|
|||
var providerId = $('#select-provider').val();
|
||||
|
||||
if (providerId === 'any-provider') {
|
||||
providerId = GlobalVariables.availableProviders[0].id; // Use first available provider.
|
||||
for (var availableProvider of GlobalVariables.availableProviders) {
|
||||
if (availableProvider.services.indexOf(serviceId) !== -1) {
|
||||
providerId = availableProvider.id; // Use first available provider.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var provider = GlobalVariables.availableProviders.find(function (availableProvider) {
|
||||
|
|
Loading…
Reference in a new issue