Add update consolidado command and queuing

This commit is contained in:
2022-04-18 22:13:17 -04:00
parent cf27465d75
commit 6ff584013f
19 changed files with 328 additions and 70 deletions

View File

@ -23,7 +23,7 @@ class Queue extends Model {
$this->created = $fecha->format('Y-m-d H:i:s');
return $this;
}
public function hasArguments() {
public function hasArguments(): bool {
return Model::factory(QueueArgument::class)
->whereEqual('queue_id', $this->id)
->groupBy('queue_id')
@ -36,10 +36,25 @@ class Queue extends Model {
}
return $this->arguments;
}
public function isProcessed() {
public function matchArguments(array $arguments): array {
$args = $this->arguments();
if ($args === null) {
return [];
}
$matched = [];
foreach ($arguments as $argument => $value) {
foreach ($args as $arg) {
if ($arg->argument == $argument and $arg->value == $value) {
$matched []= $arg;
}
}
}
return $matched;
}
public function isProcessed(): bool {
return $this->processed > 0;
}
public function setProcessed(bool $processed) {
public function setProcessed(bool $processed): Queue {
$this->processed = $processed ? 1 : 0;
return $this;
}