Skip to content

Commit

Permalink
Bug SAFeSEA#31, fixes to utils/CliApp, EssayAnalyser [iet:10299536]
Browse files Browse the repository at this point in the history
  • Loading branch information
nfreear committed Feb 3, 2018
1 parent ed60d33 commit b5403c4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

$result = oeApp::createDatabase();

Clio::output('>> OK. Database created: '. $database);
Clio::output('>> OK. Database created: '. $result->database);
print_r( $result );
exit;
}
Expand All @@ -56,7 +56,7 @@
Clio::error('Database Error: ' . $ex->getMessage()); // Table exists ??
exit( 1 );
}
Clio::output('>> OK. Tables created. Schema: ' . oeApp::SCHEMA_FILE);
Clio::output("\n" . '>> OK. Tables created. Schema: ' . oeApp::SCHEMA_FILE);

print_r( $result );
exit;
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/user.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ public function submitDraft($taskId)
$versionId = $formdata["version"] = $post["version"];

$analyser = new IET_OU\OpenEssayist\Utils\EssayAnalyser();
$result = $analyser->setup();
$result = $analyser->initResult();

try {
$result = $analyser->analyseAndSave( $taskId, $this->user[ 'id' ] );
Expand Down
6 changes: 5 additions & 1 deletion app/utils/CliApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ public static function createDatabase()
$result = $dbh->exec("CREATE DATABASE IF NOT EXISTS `$database`;")
or die(print_r($dbh->errorInfo(), true));

return $result;
return (object) [
'result' => $result,
'database' => $database,
'dbh' => $dbh,
];
}

/**
Expand Down
9 changes: 6 additions & 3 deletions app/utils/EssayAnalyser.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

class EssayAnalyser extends \Application
{
public function setup()
/**
* @return object Return an initialized 'result' object.
*/
public function initResult()
{
return (object) [
'status' => 200,
Expand All @@ -25,15 +28,15 @@ public function setup()
*
* @param int $taskId
* @param int $userId
* @return object A result object.
* @return object A 'result' object.
*/
public function analyseAndSave( $taskId, $userId )
{
$req = $this->app->request();
$log = $this->app->getLog();
$post = $req->post();

$result = $this->setup();
$result = $this->initResult();

$url = $this->getAnalyserUrl('/api/analysis');

Expand Down

0 comments on commit b5403c4

Please sign in to comment.