Skip to content

Commit

Permalink
fix "sphere-engine" judging, bugged: 49fd928
Browse files Browse the repository at this point in the history
  • Loading branch information
ndrwnaguib committed Oct 7, 2020
1 parent fbdf8d3 commit 4664486
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 32 deletions.
4 changes: 2 additions & 2 deletions clients/mod/assign/feedback/onlinejudge/source.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@
* which is not valid for the syntax highlighter so we have to reformat it.
*/
if (onlinejudge_judge_name($onlinejudge->language) == 'sphere_engine') {
$lang = strtok($onlinejudge->language, '_');
$lang = strtok($onlinejudge->language, '-');
$lang = judge_sphere_engine::get_language_name($lang);
} else
$lang = strtok($onlinejudge->language, '_');
$lang = strtok($onlinejudge->language, '-');

$lines = array();
foreach ($files as $file) {
Expand Down
6 changes: 3 additions & 3 deletions clients/mod/assign/feedback/onlinejudge/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////

$plugin->version = 2018061400;
$plugin->version = 2020100400;
$plugin->requires = 2017111300; // Requires this Moodle version
$plugin->component = 'assignfeedback_onlinejudge';
$plugin->maturity = MATURITY_BETA;
$plugin->release = "3.0 beta4"; // User-friendly version number
$plugin->dependencies = array('local_onlinejudge' => 2018061400);
$plugin->release = "v3.1-r1"; // User-friendly version number
$plugin->dependencies = array('local_onlinejudge' => 2020100700);

4 changes: 2 additions & 2 deletions judge/sandbox/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static function get_languages() {
return $langs;
}
foreach (self::$supported_languages as $key => $value) {
$langs[$key . '_sandbox'] = get_string('lang' . $key . '_sandbox', 'local_onlinejudge');
$langs[$key . '-sandbox'] = get_string('lang' . $key . '-sandbox', 'local_onlinejudge');
}
return $langs;
}
Expand Down Expand Up @@ -91,7 +91,7 @@ static function is_available() {
* @return compiler information or null
*/
static function get_compiler_info($language) {
$language = substr($language, 0, strrpos($language, '_'));
$language = substr($language, 0, strpos($language, '-'));
return self::$supported_languages[$language];
}

Expand Down
4 changes: 2 additions & 2 deletions judge/sphere_engine/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static function get_languages() {
return $langs;
}
foreach (self::$supported_languages as $langid => $name) {
$langs[$langid . '_' . 'sphere_engine'] = $name;
$langs[$langid . '-' . 'sphere_engine'] = $name;
}
return $langs;
}
Expand Down Expand Up @@ -156,7 +156,7 @@ function judge() {
$details = $submission_data['result'];
$task->stdout = $client->getSubmissionStream($submisison_id, 'output');;
$task->stderr = $details['streams']['error'];
$task->compileroutput = $details['cmpinfo'];
$task->compileroutput = $details['streams']['cmpinfo'];
$task->memusage = $details['memory'];
$task->cpuusage = $details['time'];
$task->infoteacher = get_string('seresultlink', 'local_onlinejudge', array('end_point' => $end_point, 'submission_id' => $submisison_id, 'access_token' => $access_token));
Expand Down
4 changes: 2 additions & 2 deletions judgelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class judge_base {

function __construct($task) {
$this->task = $task;
$this->language = substr($this->task->language, 0, strrpos($this->task->language, '_'));
$this->language = substr($this->task->language, 0, strpos($this->task->language, '-'));
}

/**
Expand Down Expand Up @@ -424,7 +424,7 @@ function onlinejudge_get_judge_classes() {
* Parse judge engine name from language
*/
function onlinejudge_judge_name($language) {
return substr($language, strpos($language, '_') + 1);
return substr($language, strpos($language, '-') + 1);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions lang/en/local_onlinejudge.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
Or, it is possible that there are too much tasks in the queue and you should consider to run multiply judge daemons.';
$string['judgednotifysubject'] = '{$a->count} pending tasks have been waiting too long';
$string['judgestatus'] = 'Online Judge has judged <strong>{$a->judged}</strong> tasks and there are <strong>{$a->pending}</strong> tasks in the waiting queue.';
$string['langc_sandbox'] = 'C (run locally)';
$string['langc_warn2err_sandbox'] = 'C (run locally, warnings as errors)';
$string['langcpp_sandbox'] = 'C++ (run locally)';
$string['langcpp_warn2err_sandbox'] = 'C++ (run locally, warnings as errors)';
$string['langc-sandbox'] = 'C (run locally)';
$string['langc_warn2err-sandbox'] = 'C (run locally, warnings as errors)';
$string['langcpp-sandbox'] = 'C++ (run locally)';
$string['langcpp_warn2err-sandbox'] = 'C++ (run locally, warnings as errors)';
$string['judgecheckinterval'] = 'Judge Daemon Check Interval (second)';
$string['judgecheckinterval_help'] = 'How many seconds the judge daemon should wait before judging all un-judged tasks.';
$string['maxcpulimit'] = 'Maximum CPU usage (second)';
Expand Down
8 changes: 4 additions & 4 deletions lang/pl/local_onlinejudge.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
$string['invalidtaskid'] = 'Złe id zadania: {$a}';
$string['judgednotifysubject'] = '{$a->count} oczekujących zadań, oczekuje zbyt dług';
$string['judgestatus'] = 'Online Judge ocenił <strong>{$a->judged}</strong> zadań i teraz jest <strong>{$a->pending}</strong> zadan oczekujących.';
$string['langc_sandbox'] = 'C (wykonaj lokalnie)';
$string['langc_warn2err_sandbox'] = 'C (wykonaj lokalnie, ostrzeżenia traktuj jako błędy)';
$string['langcpp_sandbox'] = 'C++ (wykonaj lokalnie)';
$string['langcpp_warn2err_sandbox'] = 'C++ (wykonaj lokalnie, ostrzeżenia traktuj jako błędy)';
$string['langc-sandbox'] = 'C (wykonaj lokalnie)';
$string['langc_warn2err-sandbox'] = 'C (wykonaj lokalnie, ostrzeżenia traktuj jako błędy)';
$string['langcpp-sandbox'] = 'C++ (wykonaj lokalnie)';
$string['langcpp_warn2err-sandbox'] = 'C++ (wykonaj lokalnie, ostrzeżenia traktuj jako błędy)';
$string['maxcpulimit'] = 'Maksymalne użycie CPU (w sekundach)';
$string['maxcpulimit_help'] = 'How long can a program been judged keep running.';
$string['maxmemlimit'] = 'Maksymalne użycie pamięci (MB)';
Expand Down
8 changes: 4 additions & 4 deletions lang/pt_br/local_onlinejudge.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@
Voc� deve inicia-lo o mais rapidamente possivel!';
$string['judgednotifysubject'] = '{$a->count} tarefas pendentes que esperaram tempo de mais';
$string['judgestatus'] = 'Analisador on-line tem <strong> {$a->judged} </strong> tarefas julgadas e <strong> {$a->pending} </strong> tarefas na fila de espera.';
$string['langc_sandbox'] = 'C (executado localmente)';
$string['langc_warn2err_sandbox'] = 'C (executado localmente, avisos como erros)';
$string['langcpp_sandbox'] = 'C + + (executado localmente)';
$string['langcpp_warn2err_sandbox'] = 'C + + (executado localmente, avisos como erros)';
$string['langc-sandbox'] = 'C (executado localmente)';
$string['langc_warn2err-sandbox'] = 'C (executado localmente, avisos como erros)';
$string['langcpp-sandbox'] = 'C + + (executado localmente)';
$string['langcpp_warn2err-sandbox'] = 'C + + (executado localmente, avisos como erros)';
$string['maxcpulimit'] = 'Maximo o uso da CPU (segundo)';
$string['maxcpulimit_help'] = 'Quanto tempo um programa pode continuar executando.';
$string['maxmemlimit'] = 'Utilizacao maxima da memoria (MB)';
Expand Down
8 changes: 4 additions & 4 deletions lang/zh_cn/local_onlinejudge.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@
还有一种可能是任务队列里有太多任务了。您可以考虑多运行几个后台评测进程。';
$string['judgednotifysubject'] = '有{$a->count}个待测任务已经等待得太久';
$string['judgestatus'] = '在线评测已经评测了<strong>{$a->judged}</strong>个任务。现在等待队列中还有<strong>{$a->pending}</strong>个任务。';
$string['langc_sandbox'] = 'C (本地运行)';
$string['langc_warn2err_sandbox'] = 'C (本地运行,警告视为错误)';
$string['langcpp_sandbox'] = 'C++ (本地运行)';
$string['langcpp_warn2err_sandbox'] = 'C++ (本地运行,警告视为错误)';
$string['langc-sandbox'] = 'C (本地运行)';
$string['langc_warn2err-sandbox'] = 'C (本地运行,警告视为错误)';
$string['langcpp-sandbox'] = 'C++ (本地运行)';
$string['langcpp_warn2err-sandbox'] = 'C++ (本地运行,警告视为错误)';
$string['maxcpulimit'] = '最多可用CPU时间(秒)';
$string['maxcpulimit_help'] = '一个被测程序最多可以运行多长时间。';
$string['maxmemlimit'] = '最多可用内存(MB)';
Expand Down
8 changes: 6 additions & 2 deletions readme.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,12 @@ In order to start using sphere engine, navigate to the following path:
and run:

```bash
composer require guzzlehttp/guzzle
```
composer install
```

[TIP]
Sphere Engine accepts only one file. So, ensure that the "Maximum number of uploaded files" under "Submission types"
is equal to `1`.

= Usage

Expand Down
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$plugin->component = 'local_onlinejudge'; // Declare the type and name of this plugin.
$plugin->version = 2020081400; // The (date) version of this plugin
$plugin->version = 2020100700; // The (date) version of this plugin
$plugin->requires = 2017111300; // Requires this Moodle version

$plugin->maturity = MATURITY_BETA;
$plugin->release = "3.0 beta4"; // User-friendly version number
$plugin->maturity = MATURITY_RC;
$plugin->release = "v3.1-r3"; // User-friendly version number

0 comments on commit 4664486

Please sign in to comment.