Add some debug to non strict search

This commit is contained in:
James Cole 2024-01-20 06:53:43 +01:00
parent 2570ca9573
commit d8d8002f1e
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -279,24 +279,30 @@ class SearchRuleEngine implements RuleEngineInterface
private function findNonStrictRule(Rule $rule): Collection
{
app('log')->debug(sprintf('findNonStrictRule(#%d)', $rule->id));
// start a search query for individual each trigger:
$total = new Collection();
$count = 0;
$triggers = [];
if ($this->refreshTriggers) {
app('log')->debug('Will refresh triggers.');
$triggers = $rule->ruleTriggers()->orderBy('order', 'ASC')->get();
}
if (!$this->refreshTriggers) {
app('log')->debug('Will not refresh triggers.');
$triggers = $rule->ruleTriggers;
}
app('log')->debug(sprintf('Will run %d trigger(s).', count($triggers)));
/** @var RuleTrigger $ruleTrigger */
foreach ($triggers as $ruleTrigger) {
app('log')->debug(sprintf('Now at rule trigger #%d: %s:"%s" (%s).', $ruleTrigger->id, $ruleTrigger->trigger_type, $ruleTrigger->trigger_value, var_export($ruleTrigger->stop_processing, true)));
if (false === $ruleTrigger->active) {
app('log')->debug('Trigger is not active, continue.');
continue;
}
if ('user_action' === $ruleTrigger->trigger_type) {
app('log')->debug('Skip trigger type.');
app('log')->debug('Skip trigger type. continue.');
continue;
}
@ -334,7 +340,7 @@ class SearchRuleEngine implements RuleEngineInterface
app('log')->debug(sprintf('Total collection is now %d transactions', $total->count()));
++$count;
// if trigger says stop processing, do so.
if ($ruleTrigger->stop_processing && $collection->count() > 0) {
if ($ruleTrigger->stop_processing && $result->count() > 0) {
app('log')->debug('The trigger says to stop processing, so stop processing other triggers.');
break;