src/Controllers/HailController.php
public function progress(HTTPRequest $request)
    {
        if (!Security::getCurrentUser()) {
            return $this->makeJsonReponse(401, [
                'message' => 'Unauthorized.'
            ])->setStatusDescription('Unauthorized.');
        }

        $latest_job = FetchJob::get()->filter('ErrorShown', 0)->sort('Created DESC')->first();

        if ($latest_job) {
            $map = $latest_job->toMap();
            if ($latest_job->Status === "Error") {
                $latest_job->ErrorShown = 1;
                $latest_job->write();
            }

            return $this->makeJsonReponse(200, $map);
        }

        return $this->makeJsonReponse(200, [
            'message' => 'No hail job found.',
            'Status' => 'Done'
        ]);

    }
public function progress(HTTPRequest $request)
    {
        if (!Security::getCurrentUser()) {
            return $this->makeJsonReponse(401, [
                'message' => 'Unauthorized.'
            ])->setStatusDescription('Unauthorized.');
        }

        $latest_job = FetchJob::get()->filter('ErrorShown', 0)->sort('Created DESC')->first();

        if ($latest_job) {
            $map = $latest_job->toMap();
            if ($latest_job->Status === "Error") {
                $latest_job->ErrorShown = 1;
                $latest_job->write();
            }

            return $this->makeJsonReponse(200, $map);
        }

        return $this->makeJsonReponse(200, [
            'message' => 'No hail job found.',
            'Status' => 'Done'
        ]);

    }
public function progress ( HTTPRequest $ request ) { if ( ! Security :: getCurrentUser ( ) ) { return $ this -> makeJsonReponse ( 401 , [ 'message' => 'Unauthorized.' ] ) -> setStatusDescription ( 'Unauthorized.' ) ; } $ latest_job = FetchJob :: get ( ) -> filter ( 'ErrorShown' , 0 ) -> sort ( 'Created DESC' ) -> first ( ) ; if ( $ latest_job ) { $ map = $ latest_job -> toMap ( ) ; if ( $ latest_job -> Status === "Error" ) { $ latest_job -> ErrorShown = 1 ; $ latest_job -> write ( ) ; } return $ this -> makeJsonReponse ( 200 , $ map ) ; } return $ this -> makeJsonReponse ( 200 , [ 'message' => 'No hail job found.' , 'Status' => 'Done' ] ) ; }
Get the progress on the current fetch job running

@param HTTPRequest $request Current request

@return HTTPResponse JSON response
@throws
Get the progress on the current fetch job running