Scheduling UI corrected
This commit is contained in:
@ -12,7 +12,7 @@ class Jobs
|
||||
{
|
||||
use Json;
|
||||
|
||||
public function schedule(ServerRequestInterface $request, ResponseInterface $response, Service $jobsService): ResponseInterface
|
||||
public function schedule(ServerRequestInterface $request, ResponseInterface $response, Service $service, \ProVM\Common\Service\Messages $messagesService): ResponseInterface
|
||||
{
|
||||
$body = $request->getBody();
|
||||
$json = \Safe\json_decode($body->getContents());
|
||||
@ -25,21 +25,24 @@ class Jobs
|
||||
'scheduled' => 0
|
||||
];
|
||||
foreach ($json->messages as $message_id) {
|
||||
if ($jobsService->schedule($message_id)) {
|
||||
if ($service->schedule($message_id)) {
|
||||
$message = $messagesService->getRepository()->fetchById($message_id);
|
||||
$message->doesHaveScheduledDownloads();
|
||||
$messagesService->getRepository()->save($message);
|
||||
$output['scheduled'] ++;
|
||||
}
|
||||
}
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
public function pending(ServerRequestInterface $request, ResponseInterface $response, Service $jobsService): ResponseInterface
|
||||
public function pending(ServerRequestInterface $request, ResponseInterface $response, Service $service): ResponseInterface
|
||||
{
|
||||
$pending = array_map(function(Job $job) {
|
||||
return $job->toArray();
|
||||
}, $jobsService->getPending());
|
||||
}, $service->getPending());
|
||||
$output = [
|
||||
'total' => count($pending),
|
||||
'pending' => $pending
|
||||
];
|
||||
return $this->withJson($response, $output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user