This commit is contained in:
Korina Cordero 2021-07-26 07:27:36 +00:00
parent 3a43cc14fb
commit 2650ac01c5
4 changed files with 23 additions and 7 deletions

View file

@ -74,7 +74,7 @@ API_LOGGING=set_to_true_or_false
CUST_DISTANCE_LIMIT=5 CUST_DISTANCE_LIMIT=5
# customer distance limit in km for admin panel # customer distance limit in km for admin panel
ADMIN_PANEL_CUST_DISTANCE_LIMIT=5 CUST_DISTANCE_LIMIT_ADMIN_PANEL=5
MAPTILER_API_KEY=map_tiler_api_key MAPTILER_API_KEY=map_tiler_api_key

View file

@ -170,7 +170,7 @@ services:
App\Service\JobOrderHandler\ResqJobOrderHandler: App\Service\JobOrderHandler\ResqJobOrderHandler:
arguments: arguments:
$country_code: "%env(COUNTRY_CODE)%" $country_code: "%env(COUNTRY_CODE)%"
$cust_distance_limit: "%env(ADMIN_PANEL_CUST_DISTANCE_LIMIT)%" $cust_distance_limit: "%env(CUST_DISTANCE_LIMIT_ADMIN_PANEL)%"
#job order generator interface #job order generator interface
App\Service\JobOrderHandlerInterface: "@App\\Service\\JobOrderHandler\\ResqJobOrderHandler" App\Service\JobOrderHandlerInterface: "@App\\Service\\JobOrderHandler\\ResqJobOrderHandler"

View file

@ -1027,12 +1027,20 @@ class APIController extends Controller implements LoggedController
$hub_criteria = new HubCriteria(); $hub_criteria = new HubCriteria();
$hub_criteria->setPoint($jo->getCoordinates()); $hub_criteria->setPoint($jo->getCoordinates());
// get distance limit for mobile from env
$dotenv = new Dotenv();
$dotenv->loadEnv(__DIR__.'/../../.env');
$limit_distance = $_ENV['CUST_DISTANCE_LIMIT'];
// set distance limit
$hub_criteria->setLimitDistance($limit_distance);
if ($hub_geofence->isCovered($long, $lat)) if ($hub_geofence->isCovered($long, $lat))
{ {
// TODO: set this properly, since the other flags // TODO: set this properly, since the other flags
// are on default values. // are on default values.
// if true, set other values for HubCriteria // if true, set other values for HubCriteria
// error_log('Area is covered by hub filtering'); error_log('Area is covered by hub filtering');
$hub_criteria->setJoType($jo->getServiceType()) $hub_criteria->setJoType($jo->getServiceType())
->setPaymentMethod($jo->getModeOfPayment()) ->setPaymentMethod($jo->getModeOfPayment())
->setRoundRobin(true); ->setRoundRobin(true);
@ -1096,7 +1104,7 @@ class APIController extends Controller implements LoggedController
else else
{ {
// log hub into hub_filter_log // log hub into hub_filter_log
$hub_filter_logger->logFilteredHub($nearest_hub['hub'], 'no_available_rider'); $hub_filter_logger->logFilteredHub($nearest_hub['hub'], 'no_available_rider', null, $cust->getID());
// continue to go through list to find hub with an available rider // continue to go through list to find hub with an available rider
} }
} }
@ -2758,12 +2766,20 @@ class APIController extends Controller implements LoggedController
$hub_criteria = new HubCriteria(); $hub_criteria = new HubCriteria();
$hub_criteria->setPoint($jo->getCoordinates()); $hub_criteria->setPoint($jo->getCoordinates());
// get distance limit for mobile from env
$dotenv = new Dotenv();
$dotenv->loadEnv(__DIR__.'/../../.env');
$limit_distance = $_ENV['CUST_DISTANCE_LIMIT'];
// set distance limit
$hub_criteria->setLimitDistance($limit_distance);
if ($hub_geofence->isCovered($long, $lat)) if ($hub_geofence->isCovered($long, $lat))
{ {
// if true, set other values for HubCriteria // if true, set other values for HubCriteria
// TODO: set this properly, since the other flags // TODO: set this properly, since the other flags
// are on default values // are on default values
// error_log('Area is covered by hub filtering'); error_log('Area is covered by hub filtering');
$hub_criteria->setJoType($jo->getServiceType()) $hub_criteria->setJoType($jo->getServiceType())
->setPaymentMethod($jo->getModeOfPayment()) ->setPaymentMethod($jo->getModeOfPayment())
->setRoundRobin(true); ->setRoundRobin(true);
@ -2827,7 +2843,7 @@ class APIController extends Controller implements LoggedController
else else
{ {
// log hub into hub_filter_log // log hub into hub_filter_log
$hub_filter_logger->logFilteredHub($nearest_hub['hub'], 'no_available_rider'); $hub_filter_logger->logFilteredHub($nearest_hub['hub'], 'no_available_rider', null, $cust->getID());
// continue to go through list to find hub with an available rider // continue to go through list to find hub with an available rider
} }
} }

View file

@ -108,7 +108,7 @@ class HubDistributor
return 1; return 1;
}); });
error_log('arranged hubs ' . json_encode($arranged_hubs)); // error_log('arranged hubs ' . json_encode($arranged_hubs));
return $arranged_hubs; return $arranged_hubs;
} }