This commit is contained in:
James Cole
2017-09-25 09:28:16 +02:00
parent c917d2b1c4
commit ea1d543795
8 changed files with 59 additions and 10 deletions

View File

@@ -20,6 +20,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Collection;
use Log;
/**
* Class ExecuteRuleOnExistingTransactions
@@ -128,18 +129,27 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue
{
// Lookup all journals that match the parameters specified
$transactions = $this->collectJournals();
$processor = Processor::make($this->rule);
$processor = Processor::make($this->rule, true);
$hits = 0;
$misses = 0;
$total = 0;
// Execute the rules for each transaction
foreach ($transactions as $transaction) {
$processor->handleTransaction($transaction);
$total++;
$result = $processor->handleTransaction($transaction);
if($result) {
$hits++;
}
if(!$result) {
$misses++;
}
Log::info(sprintf('Current progress: %d Transactions. Hits: %d, misses: %d', $total, $hits, $misses));
// Stop processing this group if the rule specifies 'stop_processing'
if ($processor->getRule()->stop_processing) {
break;
}
}
Log::info(sprintf('Total transactions: %d. Hits: %d, misses: %d', $total, $hits, $misses));
}