Skip to content

Confirmation output from the previous attempt #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion classes/combinator_grader_outcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ class qtype_coderunner_combinator_grader_outcome extends qtype_coderunner_testin
// A list of the allowed attributes in the combinator template grader return value.
public $allowedfields = array('fraction', 'prologuehtml', 'testresults', 'epiloguehtml',
'feedbackhtml', 'columnformats', 'showdifferences',
'showoutputonly'
'showoutputonly', 'attemptconfirmhtml'
);

public function __construct($isprecheck) {
parent::__construct(1, 0, $isprecheck);
$this->actualmark = 0;
$this->epiloguehtml = null;
$this->prologuehtml = null;
$this->attemptconfirmhtml = null;
$this->testresults = null;
$this->columnformats = null;
$this->outputonly = false;
Expand Down Expand Up @@ -200,6 +201,10 @@ public function show_differences() {
$this->showdifferences && isset($this->testresults);
}

public function get_attempt_confirm() {
return empty($this->attemptconfirmhtml) ?
'' : $this->attemptconfirmhtml;
}

// Check that if a columnformats field is supplied
// the number of entries is correct and that each entry is either '%s'
Expand Down
4 changes: 4 additions & 0 deletions classes/testing_outcome.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ public function get_epilogue() {
return '';
}

public function get_attempt_confirm() {
return '';
}

public function get_sourcecode_list() {
return $this->sourcecodelist;
}
Expand Down
9 changes: 9 additions & 0 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,15 @@ public function formulation_and_controls(question_attempt $qa, question_display_
$PAGE->requires->js_call_amd('qtype_coderunner/textareas', 'initQuestionTA', array($responsefieldid));
}

// with the isoutputonly option, give feedback on the answer status here?
$toserialised = $qa->get_last_qt_var('_testoutcome');
if ($toserialised) {
$outcome = unserialize($toserialised);
if ($outcome !== false) {
$qtext .= $outcome->get_attempt_confirm();
}
}

return $qtext;
}

Expand Down