jcrodriguez-dis / moodle-mod_vpl

Virtual Programming Lab for Moodle (Module)
GNU General Public License v3.0
99 stars 85 forks source link

webservice problem #82

Closed GuillaumeBlin closed 4 years ago

GuillaumeBlin commented 5 years ago

Hello, it seems that the save function from the externallib.php file is not working anymore using the webservice. My guess is that

foreach ($oldfiles as $file) {
            $files [ $file->name ] = $file->data;
        }

should be replaced by

foreach ($oldfiles as $file) {
     $files [ $file['name'] ] = $file['data'];
}

or file should be cast as an object before trying to access to the name and data properties. I might miss something but it fixed the bug for me. In fact, i'm trying to design a vs code extension based on the vpl webservice. Considering, the evaluate webservice function, I am wondering if it is possible to use the monitor websocket returned to know the status of the evaluation before retrieving the result. By the way, I think there is another bug , this time in evaluate function from the externallib.php file with

$ret = mod_vpl_edit::execute( $vpl, $USER->id, 'evaluate' );
        return array (
                'monitorURL' => $ret->monitorURL
        );

since monitorURL is not returned by the new version of execute function; it returns the following object

$response = new stdClass();
 $response->server = $parsed ['host'];
 $response->monitorPath = $jailresponse ['monitorticket'] . '/monitor';
 $response->executionPath = $jailresponse ['executionticket'] . '/execute';
 $response->port = $jailresponse ['port'];
 $response->securePort = $jailresponse ['secureport'];
 $response->wsProtocol = $plugincfg->websocket_protocol;
 $response->VNCpassword = substr( $jailresponse ['executionticket'], 0, 8 );
 $instance = $this->get_instance();

Thanks again for the great work that we are using everyday at Université de Bordeaux. Best

jcrodriguez-dis commented 4 years ago

Resolved in VPL 3.3.5 just released