|
From: <dav...@us...> - 2010-03-30 10:53:50
|
Revision: 2407
http://qtitools.svn.sourceforge.net/qtitools/?rev=2407&view=rev
Author: davemckain
Date: 2010-03-30 10:53:43 +0000 (Tue, 30 Mar 2010)
Log Message:
-----------
playr:
* Fixed URL for retrieving test results
* Changed handling of 404's from backend engine during test
playing. This happens if the session times out of if the backend
engine gets restarted. Now flashes a "sorry, blah timeout blah" message,
rather than error page. Also, the front-end question sessions gets
reset here too, which is probably better behaviour. Need to decide
whether to update the report or not, though.
Modified Paths:
--------------
branches/mathassess/qtiplayr/playr.inc.php
branches/mathassess/qtiplayr/playrlib.inc.php
Modified: branches/mathassess/qtiplayr/playr.inc.php
===================================================================
--- branches/mathassess/qtiplayr/playr.inc.php 2010-03-30 08:49:52 UTC (rev 2406)
+++ branches/mathassess/qtiplayr/playr.inc.php 2010-03-30 10:53:43 UTC (rev 2407)
@@ -17,6 +17,7 @@
$ASSESS_ID = $SESSID."_assess";
$response = NULL;
+$result = "";
if (!isset($_SESSION[$SESSID])) {
//create a session
$response = playr_init();
@@ -48,11 +49,21 @@
$response = playr_play($sessionid, $_POST);
}
-$result = $response->get_body();
-$maEngineContentType = $response->get_content_type();
-$maEngineResult = $result;
-$maEngineResultHead = preg_replace('!^.*?<head.*?>(.*)</head>.*$!si', '$1', $result);
-$maEngineResultBody = preg_replace('!^.*?<body.*?>(.*)</body>.*$!si', '$1', $result);
+if ($response==null) {
+ // (NB: A side effect of this will be that the session gets unset below, which is
+ // probably good behaviour but I need to check this.)
+ $maEngineFailed = true;
+ $flash = "Sorry, the test has been terminated. This might have happened because you took "
+ . "too long to complete the test in this session, "
+ . "or because our test software was restarted";
+}
+else {
+ $result = $response->get_body();
+ $maEngineContentType = $response->get_content_type();
+ $maEngineResult = $result;
+ $maEngineResultHead = preg_replace('!^.*?<head.*?>(.*)</head>.*$!si', '$1', $result);
+ $maEngineResultBody = preg_replace('!^.*?<body.*?>(.*)</body>.*$!si', '$1', $result);
+}
// DM: I've left this out of MAEngine as it's a bit smelly, but there must
// be a good reason for having this!
Modified: branches/mathassess/qtiplayr/playrlib.inc.php
===================================================================
--- branches/mathassess/qtiplayr/playrlib.inc.php 2010-03-30 08:49:52 UTC (rev 2406)
+++ branches/mathassess/qtiplayr/playrlib.inc.php 2010-03-30 10:53:43 UTC (rev 2407)
@@ -117,8 +117,8 @@
return $http_client->get_response();
}
else {
- // FIXME: This might happen if the MAEngine session times out, which we want to avoid!
- error('Error playing test; Server returned status code : ' . $http_client->get_response()->get_status());
+ // This will happen if the backend session times out (or is restarted)
+ return null;
}
}
@@ -134,7 +134,7 @@
if(!$http_client->_response->cookies->set("JSESSIONID", $sessionid, $http_client->host, $CFG->qtiplayr_contextpath, "")){}
- if ($http_client->get("/test/report/0") == HTTP_STATUS_OK) {
+ if ($http_client->get("/article/report/0") == HTTP_STATUS_OK) {
return $http_client->get_response()->get_body();
}
else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|