Rename import procedure method name

This commit is contained in:
James Cole 2016-08-26 06:43:23 +02:00
parent fd8ed4c9aa
commit 58ca7d551a
3 changed files with 32 additions and 3 deletions

View File

@ -67,7 +67,9 @@ class Import extends Command
$handler = new CommandHandler($this);
$monolog->pushHandler($handler);
$result = ImportProcedure::run($job);
$result = ImportProcedure::runImport($job);
/**
* @var int $index

View File

@ -306,7 +306,7 @@ class ImportController extends Controller
public function start(ImportJob $job)
{
if ($job->status == "settings_complete") {
ImportProcedure::run($job);
$journals = ImportProcedure::runImport($job);
}
}

View File

@ -23,13 +23,40 @@ use Illuminate\Support\Collection;
*/
class ImportProcedure
{
//
// /**
// * @param ImportJob $job
// * @param Collection $journals
// */
// public static function runRules(ImportJob $job, Collection $journals)
// {
// // get all rules for user.
// $rules
// = Rule::distinct()
// ->where('user_id', $job->user->id)
// ->leftJoin('rule_groups', 'rule_groups.id', '=', 'rules.rule_group_id')
// ->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id')
// ->where('rule_groups.active', 1)
// ->where('rule_triggers.trigger_type', 'user_action')
// ->where('rule_triggers.trigger_value', 'store-journal')
// ->where('rules.active', 1)
// ->orderBy('rule_groups.order', 'ASC')
// ->orderBy('rules.order', 'ASC')
// ->get(['rules.*']);
//
// // execute rules on each transaction.
// /** @var TransactionJournal $journal */
// foreach($journals as $journal) {
// self::applyRules($rules, $journal);
// }
// }
/**
* @param ImportJob $job
*
* @return Collection
*/
public static function run(ImportJob $job): Collection
public static function runImport(ImportJob $job): Collection
{
// update job to say we started.
$job->status = 'import_running';