From: Matt L. v. a. <we...@ma...> - 2007-09-11 20:16:43
|
Log Message: ----------- Version .4 Partial Answer Questions now supported Modified Files: -------------- wwmoodle/wwquestion: README.txt config.php display.html edit_webwork_form.php file.php locallib.php questiontype.php version.txt wwmoodle/wwquestion/db: install.xml wwmoodle/wwquestion/lang/en_utf8: qtype_webwork.php Revision Data ------------- Index: config.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwquestion/config.php,v retrieving revision 1.1 retrieving revision 1.2 diff -Lwwquestion/config.php -Lwwquestion/config.php -u -r1.1 -r1.2 --- wwquestion/config.php +++ wwquestion/config.php @@ -1,7 +1,7 @@ <?php //Path to the WSDL file on the Webwork Server -define('WWQUESTION_WSDL','http://128.151.231.20/problemserver_files/WSDL.wsdl'); +define('WWQUESTION_WSDL','ENTER YOUR WSDL PATH HERE','WSDL Path Test'); //Leave the rest alone define('WWQUESTION_PREFIX','/wwquestions'); Index: version.txt =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwquestion/version.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -Lwwquestion/version.txt -Lwwquestion/version.txt -u -r1.1 -r1.2 --- wwquestion/version.txt +++ wwquestion/version.txt @@ -1,5 +1,12 @@ Old versions: +Version .3 (9/11/2007) +* Derivation mismatch bugs fixed. +* New Test file +* External File support! (applet,images,graphs,etc) +* Code Refactoring +* New levels of Code Checking including warnings + Version .2 (August 2007) * DB consistency issues fixed (thanks to Jean-Marc) * New code checking, makes sure PG code is correct Index: display.html =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwquestion/display.html,v retrieving revision 1.7 retrieving revision 1.8 diff -Lwwquestion/display.html -Lwwquestion/display.html -u -r1.7 -r1.8 --- wwquestion/display.html +++ wwquestion/display.html @@ -17,9 +17,12 @@ <?php if($state->event == QUESTION_EVENTGRADE) { ?> <table class="answer"> <tr class="header"> + <th class="c0"></th> + <?php if($showPartiallyCorrectAnswers == 1) { ?> <th class="c0"></th> <th class="c0">Result</th> + <?php } ?> <th class="c0">Answer</th> <th class="c0">Preview</th> <th class="c0">Evaluated</th> @@ -31,12 +34,14 @@ <td class="c0"> <?php echo $i . ')'; ?> </td> + <?php if($showPartiallyCorrectAnswers == 1) { ?> <td class="c0"> <?php echo question_get_feedback_image($answerobj['score']); ?> </td> <td class="c0" style="width: 15%;"> <?php if($answerobj['score'] == 1) { $class = 'correct'; echo "Correct"; } else { $class = 'incorrect'; echo "Incorrect"; } ?> </td> + <?php } ?> <td class="c0" style="width: 15%;"> <?php echo $answerobj['answer']; ?> </td> Index: README.txt =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwquestion/README.txt,v retrieving revision 1.5 retrieving revision 1.6 diff -Lwwquestion/README.txt -Lwwquestion/README.txt -u -r1.5 -r1.6 --- wwquestion/README.txt +++ wwquestion/README.txt @@ -1,122 +1,47 @@ Webwork Question Type ---------------------- -Version: 0.3 (stable) Released 9/9/2007 +Version: 0.4 (stable) Released 9/11/2007 Maintainer: Matthew Leventi <mle...@gm...> CVS: cvs.webwork.rochester.edu:/webwork/cvs/system wwmoodle/wwquestion -This is a moodle questiontype module that will allow webwork questions to be asked in Moodle Quizzes and Lessons. Currently it supports many of the features found in the webwork2 system. +This is a moodle questiontype module that will allow webwork questions to be asked in Moodle Quizzes and Lessons. Currently it supports many of the features found in the webwork2 system. Almost all WeBWorK questions should work with this system. (If you find one that doesnt send me a copy). * If you are using this send me an email. Feedback is appreciated. * Current Release: -* Derivation mismatch bugs fixed. -* New Test file -* External File support! (applet,images,graphs,etc) -* Code Refactoring -* New levels of Code Checking including warnings - -PG Language: What is supported? -Simple and complex pg problems including those which use applets, images, graph generation problems, etc. - -PG Language: What is not supported? -Currently the only PG files that don't fully work are those with custom graders. Hence problems will reveal which answers the student has correct despite the showCorrectAnswer flag being off. - -Upgrading (from 0.1): -A database column was added called codecheck. If you have data that you don't want to lose your going to have to add the new column manually to the db -mysql command: ALTER TABLE mdl_question_webwork ADD COLUMN codecheck int(10) not null default 0; -Then you can delete the webwork directory and recreate it from the CVS -** I am not really sure if this is backward compatible to 0.1. If you are having problems with questions edit them and submit to regenerate derived copies. +* Show Partial Answer Questions Work! +* New Unit Tests to ensure proper setup. +* Code refactoring + +Upgrading: +Backward Compatibility of existing questions is not guaranteeded. To upgrade your Database loading and unloading the webwork DB file in the XMLDB editor should make the necessary changes. Setup: 1) Make a new folder named 'webwork' in the question/type directory. -2) Copy all the files from this directory into . +2) Copy all the files into the new 'webwork' directory. 3) Point your browser to http://yourmoodle/admin to setup the question_webwork database table. Configuration: 1) Change the WSDL path variable in the webwork/config.php file to point to your Webwork Problem Server's WSDL file. -Use: -Go into the question bank and create a new WeBWorK question. -A webwork question only has three special fields. - -code: Paste the perl code that renders the webwork question here. - -seed: The starting seed to use to generate random problems - -trials: The number of attempts the generator should make to generate and cache problems. - -Finding webwork questions: -http://cvs.webwork.rochester.edu/viewcvs.cgi/rochester_problib/?cvsroot=UR+Problem+Library (for now) - -Note: -Previewing the question will use random seeds. - -Example Problem: - -##DESCRIPTION - -# Singularities, Determine Type (Poles), Residues - -##ENDDESCRIPTION - - -DOCUMENT(); # This should be the first executable line in the problem. - -loadMacros( - "PGstandard.pl", # Standard macros for PG language - "MathObjects.pl", - "PGunion.pl", # Union College macros - #"PGcourse.pl", # Customization file for the course -); - -TEXT(beginproblem()); -$showPartialCorrectAnswers = 1; - -############################################################## -# -# Setup -# -Context("Point"); - -$a = non_zero_random(-10,10,1); - -$formula_string = Formula( "sin(1/($a*z))" ); - -@singularities = ("(0, 1/$a)" ); -$f = Compute("(0,1/$a)"); -############################################################## -# -# Text -# -# -Context()->texStrings; -BEGIN_TEXT - -Find the singularities and their residues for $PAR - -\[ $formula_string \] - -$PAR -\{ans_rule(60)\} -$PAR -List the singularities and their residues as ordered pairs. (for example, -(3, pi), (-1,2) means that there is a singularity at \(3\) with residue \(\pi\) -and a singularity at \(-1\) with residue \(2\). - -$PA -END_TEXT -Context()->normalStrings; -############################################################## -# -# Answers -# -# - -ANS(List(@singularities)->cmp(correct_ans=>$f->{correct_ans}) ); - - - -ENDDOCUMENT(); # This should be the last executable line in the problem. - +Testing: +1) In the site administration -> reports -> unit tests run the webwork unit tests. Enter '/question/type/webwork/simpletest' to only run the webwork tests. +Use: +Go into the question bank and create a new WeBWorK question. Besides the usual question options there are a few WeBWorL specific fields. +Code -> Copy and paste the PG code into this field. +Files -> Upload any necessary external files that the question depends on. +Code Check -> This determines how strict the checker should be in determining whether your question works +Seed -> The starting seed on which to create question derivations. +Trials -> The number of derivations to create. (Roughly) +Note on Question Creation: +As you increase trials question creation will take longer. If you need a lot of external files question creation will also take longer. Longest time I have seen is about a minute. The reason for the delay involves the creation of derived questions based on the PG code. It means that viewing of questions should be very fast. Student answer checks will also be faster. +Note on Randomness: +WeBWorK Questions are not truly random within this module. The trials option determines the size of a pool of questions that are generated from the PG code. Students will get a random derivation out of the pool as the question they have to answer. When an instructor previews a question in the bank he/she will see a random seed. +Finding webwork questions: +http://cvs.webwork.rochester.edu/viewcvs.cgi/rochester_problib/?cvsroot=UR+Problem+Library (for now) +An example can be found in simpletest/sampleProblem.pg as well. Index: questiontype.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwquestion/questiontype.php,v retrieving revision 1.12 retrieving revision 1.13 diff -Lwwquestion/questiontype.php -Lwwquestion/questiontype.php -u -r1.12 -r1.13 --- wwquestion/questiontype.php +++ wwquestion/questiontype.php @@ -54,6 +54,7 @@ $question->seed = $record->seed; $question->code = base64_decode($record->code); $question->codecheck = $record->codecheck; + $question->grading = $record->grading; //hold onto the ID of the question_webwork record $question->webworkid = $record->id; return true; @@ -79,6 +80,12 @@ $record->code = base64_encode(stripslashes($question->code)); $record->seed = $question->seed; $record->trials = $question->trials; + + $results = webwork_qtype::_derivations(); + if(count($results) > 0) { + $record->grading = $results[0]['grading']; + } + //insert or update question in DB if($isupdate) { //update @@ -213,6 +220,8 @@ $unparsedhtml = base64_decode($derivation->html); + //partial answers + $showPartiallyCorrectAnswers = $question->grading; //new array keyed by field $fieldhash = $state->responses['answers']; @@ -228,7 +237,9 @@ if(($nodename == "INPUT") || ($nodename == "SELECT") || ($nodename == "TEXTAREA")) { $parser->iNodeAttributes['name'] = 'resp' . $question->id . '_' . $name; if(($state->event == QUESTION_EVENTGRADE) && (isset($fieldhash[$name]))) { - $parser->iNodeAttributes['class'] = $parser->iNodeAttributes['class'] . ' ' . question_get_feedback_class($fieldhash[$name]['score']); + if($showPartiallyCorrectAnswers) { + $parser->iNodeAttributes['class'] = $parser->iNodeAttributes['class'] . ' ' . question_get_feedback_class($fieldhash[$name]['score']); + } } if(!strstr($name,'previous')) { $answerfields[$name] = $fieldhash[$name]; @@ -255,6 +266,8 @@ $qid = $question->id; $seed = $state->responses['seed']; + + //if the student has answered include("$CFG->dirroot/question/type/webwork/display.html"); } @@ -285,6 +298,7 @@ $problem = array(); $problem['code'] = $code; $problem['seed'] = $seed; + $problem['files']= array(); //SOAP request $params = array(); @@ -409,23 +423,40 @@ } /** - * @desc Prints a short 40 character limited version of all the answers for a question. + * @desc Enumerates the pictures for a response. * @param $question object The question object. * @param $state object The state object. + * @return array HTML code with <img> tag for each picture. */ function get_actual_response($question, $state) { $temp = ''; $i = 1; foreach($state->responses['answers'] as $key => $value) { - $temp .= "$i) " . $value['answer'] . " "; + $responses[] = "$i) " . $value['preview']; $i++; } - $lmax = 40; - $responses[] = (strlen($temp) > $lmax) ? substr($temp, 0, $lmax).'...' : $temp; return $responses; } /** + * @desc Prints a summary of a response. + * @param $question object The question object. + * @param $state object The state object. + * @return string HTML. + */ + function response_summary($question, $state, $length=80) { + // This should almost certainly be overridden + $responses = $this->get_actual_response($question, $state); + if (empty($responses) || !is_array($responses)) { + $responses = array(); + } + if (is_array($responses)) { + $responses = implode('<br/><br/>', $responses); + } + return $responses;//substr($responses, 0, $length); + } + + /** * Changes all states for the given attempts over to a new question * * This is used by the versioning code if the teacher requests that a question @@ -529,6 +560,28 @@ } /** + * Renders the question for printing and returns the LaTeX source produced + * + * This function should render the question suitable for a printed problem + * or solution sheet in LaTeX and return the rendered output. + * @return string The LaTeX output. + * @param object $question The question to be rendered. Question type + * specific information is included. + * @param object $state The state to render the question in. The + * question type specific information is also + * included. + * @param object $cmoptions + * @param string $type Indicates if the question or the solution is to be + * rendered with the values 'question' and + * 'solution'. + */ + function get_texsource(&$question, &$state, $cmoptions, $type) { + // The default implementation simply returns a string stating that + // the question is only available online. + return get_string('onlineonly', 'texsheet'); + } + + /** * Backup the data in the question * * This is used in question/backuplib.php Index: edit_webwork_form.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwquestion/edit_webwork_form.php,v retrieving revision 1.5 retrieving revision 1.6 diff -Lwwquestion/edit_webwork_form.php -Lwwquestion/edit_webwork_form.php -u -r1.5 -r1.6 --- wwquestion/edit_webwork_form.php +++ wwquestion/edit_webwork_form.php @@ -54,11 +54,13 @@ $codecheckoptions = array( 0 => get_string('edit_codecheck0','qtype_webwork'), 1 => get_string('edit_codecheck1','qtype_webwork'), - 2 => get_string('edit_codecheck2','qtype_webwork')); + 2 => get_string('edit_codecheck2','qtype_webwork'), + 3 => get_string('edit_codecheck3','qtype_webwork'), + 4 => get_string('edit_codecheck4','qtype_webwork')); $mform->addElement('select','codecheck', get_string('edit_codecheck', 'qtype_webwork'),$codecheckoptions); $mform->setType('codecheck',PARAM_INT); $mform->setHelpButton('codecheck', array('codecheck', get_string('edit_codecheck', 'qtype_webwork'), 'webwork')); - $mform->setDefault('codecheck',2); + $mform->setDefault('codecheck',4); //SEED $mform->addElement('text', 'seed', get_string('edit_seed','qtype_webwork'), @@ -83,164 +85,26 @@ function validation($data) { global $CFG; - //check that the code is valid - $err = $this->codecheck($data); - if($err != false) { - return $err; - } - return true; - } - - function codecheck($data) { - - //codechecklevel - $codechecklevel = $data['codecheck']; - //here we construct a temp question object - $question = new stdClass; - $question->code = base64_encode(stripslashes($data['code'])); - $question->seed = $data['seed']; - $question->trials = $data['trials']; - //temporary solution - if(!isset($this->question->webworkid)) { - $path = webwork_get_tmp_path_full(); - $urlpath = webwork_get_filehandler_path() . '/' . webwork_get_tmp_path() . '/'; + //is this a copy of a current question + if(isset($this->_form->_submitValues['makecopy'])) { + $questioncopy = true; } else { - $path = webwork_get_wwquestion_path_full($this->question->webworkid); - $urlpath = webwork_get_filehandler_path() . '/' . webwork_get_wwquestion_path($this->question->webworkid) . '/'; - } - $filelist = list_directories_and_files($path); - $filearray = array(); - - foreach($filelist as $file) { - if(!is_dir($path . '/' . $file)) { - $encode = base64_encode($urlpath . '/' . $file); - array_push($filearray,$encode); - } - - } - $question->files = $filearray; - - //one call to the server will return response for this code and keep it static in the function - $results = webwork_get_derivations($question); - //127.0.0.1 - //no code check - if($codechecklevel == 0) { - webwork_qtype::_derivations($results); - return false; - } - - //init error array - $errorresults = array(); - $noerrorresults = array(); - - //see if we got errors (split) - foreach($results as $record) { - if((isset($record['errors'])) && ($record['errors'] != '') && ($record['errors'] != null)) { - array_push($errorresults,$record); - } else { - array_push($noerrorresults,$record); - } - } - - $goodresults = array(); - $warningresults = array(); - - foreach($noerrorresults as $record) { - if((isset($record['warnings'])) && ($record['warnings'] != '') && ($record['warnings'] != null)) { - array_push($warningresults,$record); - } else { - array_push($goodresults,$record); - } - - } - - - //if there are good seeds we use those - if((count($goodresults) > 0) && ($codechecklevel == 1)) { - webwork_qtype::_derivations($goodresults); - return false; - } - - //if code check is strict - if(count($goodresults) == count($results)) { - webwork_qtype::_derivations($results); - return false; + $questioncopy = false; } + //webwork_question id + $wwquestionid = $this->question->webworkid; - $errormsgs = array(); - $warningmsgs = array(); - //at this point we are going to be invalid - //this correlates seeds with certain error messages for better output - //ERRORS - foreach($errorresults as $record) { - $found = 0; - $candidate = $record['errors'] . "<br>"; - $candidateseed = $record['seed']; - for($i=0;$i<count($errormsgs);$i++) { - if($candidate == $errormsgs[$i]['errors']) { - $found = 1; - $errormsgs[$i]['seeds'][] = $candidateseed; - } - } - if($found == 0) { - //new error message - $msg = array(); - $msg['errors'] = $candidate; - $msg['seeds'] = array(); - $msg['seeds'][] = $candidateseed; - $errormsgs[] = $msg; - } + //codecheck + $result = webwork_codecheck($data,$wwquestionid,$questioncopy); + if(is_array($result)) { + return $result; } - //WARNINGS - foreach($warningresults as $record) { - $found = 0; - $candidate = $record['warnings'] . "<br>"; - $candidateseed = $record['seed']; - for($i=0;$i<count($warningmsgs);$i++) { - if($candidate == $warningmsgs[$i]['errors']) { - $found = 1; - $warningmsgs[$i]['seeds'][] = $candidateseed; - } - } - if($found == 0) { - //new error message - $msg = array(); - $msg['warnings'] = $candidate; - $msg['seeds'] = array(); - $msg['seeds'][] = $candidateseed; - $warningmsgs[] = $msg; - } - - } - $output = "Errors in PG Code on: " . count($errorresults) . " out of " . count($results) . " seeds tried:<br>"; - //construct error statement - $counter = 1; - foreach($errormsgs as $msg) { - $output .= "$counter) "; - $output .= "Seeds ("; - foreach ($msg['seeds'] as $seed) { - $output .= $seed . " "; - } - $output .= ") gave Errors:" . $msg['errors'] . "<br><br>"; - $counter++; - } - $output .= "Warnings in PG Code on: " . count($warningresults) . " out of " . count($results) . " seeds tried:<br>"; - $counter = 1; - foreach($warningmsgs as $msg) { - $output .= "$counter) "; - $output .= "Seeds ("; - foreach ($msg['seeds'] as $seed) { - $output .= $seed . " "; - } - $output .= ") gave Warnings:" . $msg['warnings'] . "<br><br>"; - $counter++; - } - $returner =array(); - $returner['code'] = $output; - return $returner; + return true; } + + function qtype() { return 'webwork'; } Index: file.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwquestion/file.php,v retrieving revision 1.2 retrieving revision 1.3 diff -Lwwquestion/file.php -Lwwquestion/file.php -u -r1.2 -r1.3 --- wwquestion/file.php +++ wwquestion/file.php @@ -29,13 +29,12 @@ } //extra security for users - if($args[1] == 'users') { + /*if((count($args) > 6) && ($args[5] == 'users')) { //trying to get a user equation image - //BEEF this up with roles etc, so teachers have access to students pics so on. - if($args[2] != $USER->id) { - error('Access Denied to this Equation Image'); + if($args[6] != $USER->id) { + require_capability('moodle/mod/quiz:viewreports'); } - } + }*/ Index: locallib.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwquestion/locallib.php,v retrieving revision 1.1 retrieving revision 1.2 diff -Lwwquestion/locallib.php -Lwwquestion/locallib.php -u -r1.1 -r1.2 --- wwquestion/locallib.php +++ wwquestion/locallib.php @@ -1,6 +1,7 @@ <?php require_once("$CFG->dirroot/question/type/webwork/config.php"); +require_once("$CFG->dirroot/question/type/webwork/questiontype.php"); require_once("$CFG->libdir/soap/nusoap.php"); require_once("$CFG->libdir/filelib.php"); require_once("$CFG->libdir/setuplib.php"); @@ -166,6 +167,183 @@ return true; } +function webwork_codecheck($data,$wwquestionid,$questioncopy) { + //codechecklevel + $codechecklevel = $data['codecheck']; + + //here we construct a temp question object + $question = new stdClass; + $question->code = base64_encode(stripslashes($data['code'])); + $question->seed = $data['seed']; + $question->trials = $data['trials']; + + //handle the new question from old functionality + if($questioncopy) { + webwork_make_tmp_dir(); + $path = webwork_get_wwquestion_path_full($wwquestionid); + $filelist = list_directories_and_files($path); + //copy everthing but derivations folder into tmp folder + foreach($filelist as $file) { + if($file != 'derivations') { + webwork_copy_file("$path/$file",webwork_get_tmp_path_full() . '/' . $file); + } + } + } + + + //should we look in tmp or in wwquestion dir to find stuff + if(!isset($wwquestionid)) { + $path = webwork_get_tmp_path_full(); + $urlpath = webwork_get_filehandler_path() . '/' . webwork_get_tmp_path() . '/'; + } else { + $path = webwork_get_wwquestion_path_full($this->question->webworkid); + $urlpath = webwork_get_filehandler_path() . '/' . webwork_get_wwquestion_path($this->question->webworkid) . '/'; + } + $filelist = list_directories_and_files($path); + $filearray = array(); + + //files that need to be pushed + foreach($filelist as $file) { + if(!is_dir($path . '/' . $file)) { + $encode = base64_encode($urlpath . '/' . $file); + array_push($filearray,$encode); + } + } + + $question->files = $filearray; + + //one call to the server will return response for this code and keep it static in the function + $results = webwork_get_derivations($question); + + //filter errors and warnings + $errorresults = array(); + $noerrorresults = array(); + $warningresults = array(); + $goodresults = array(); + foreach($results as $record) { + if((isset($record['errors'])) && ($record['errors'] != '') && ($record['errors'] != null)) { + array_push($errorresults,$record); + } else { + array_push($noerrorresults,$record); + } + } + foreach($noerrorresults as $record) { + if((isset($record['warnings'])) && ($record['warnings'] != '') && ($record['warnings'] != null)) { + array_push($warningresults,$record); + } else { + array_push($goodresults,$record); + } + } + + switch($codechecklevel) { + //No code check + case 0: + webwork_qtype::_derivations($results); + return true; + break; + //reject seeds with errors + case 1: + if(count($noerrorresults) > 0) { + webwork_qtype::_derivations($noerrorresults); + return true; + } + break; + //reject if errors + case 2: + if(count($noerrorresults) == count($results)) { + webwork_qtype::_derivations($results); + return true; + } + break; + //reject seeds with errors or warnings + case 3: + if(count($goodresults) > 0) { + webwork_qtype::_derivations($goodresults); + return true; + } + break; + //reject if errors or warnings + case 4: + if(count($goodresults) == count($results)) { + webwork_qtype::_derivations($results); + return true; + } + break; + } + + $errormsgs = array(); + $warningmsgs = array(); + //at this point we are going to be invalid + //this correlates seeds with certain error messages for better output + //ERRORS + foreach($errorresults as $record) { + $found = 0; + $candidate = $record['errors'] . "<br>"; + $candidateseed = $record['seed']; + for($i=0;$i<count($errormsgs);$i++) { + if($candidate == $errormsgs[$i]['errors']) { + $found = 1; + $errormsgs[$i]['seeds'][] = $candidateseed; + } + } + if($found == 0) { + //new error message + $msg = array(); + $msg['errors'] = $candidate; + $msg['seeds'] = array(); + $msg['seeds'][] = $candidateseed; + $errormsgs[] = $msg; + } + } + //WARNINGS + foreach($warningresults as $record) { + $found = 0; + $candidate = $record['warnings'] . "<br>"; + $candidateseed = $record['seed']; + for($i=0;$i<count($warningmsgs);$i++) { + if($candidate == $warningmsgs[$i]['errors']) { + $found = 1; + $warningmsgs[$i]['seeds'][] = $candidateseed; + } + } + if($found == 0) { + //new error message + $msg = array(); + $msg['warnings'] = $candidate; + $msg['seeds'] = array(); + $msg['seeds'][] = $candidateseed; + $warningmsgs[] = $msg; + } + + } + $output = "Errors in PG Code on: " . count($errorresults) . " out of " . count($results) . " seeds tried:<br>"; + //construct error statement + $counter = 1; + foreach($errormsgs as $msg) { + $output .= "$counter) "; + $output .= "Seeds ("; + foreach ($msg['seeds'] as $seed) { + $output .= $seed . " "; + } + $output .= ") gave Errors:" . $msg['errors'] . "<br><br>"; + $counter++; + } + $output .= "Warnings in PG Code on: " . count($warningresults) . " out of " . count($results) . " seeds tried:<br>"; + $counter = 1; + foreach($warningmsgs as $msg) { + $output .= "$counter) "; + $output .= "Seeds ("; + foreach ($msg['seeds'] as $seed) { + $output .= $seed . " "; + } + $output .= ") gave Warnings:" . $msg['warnings'] . "<br><br>"; + $counter++; + } + $returner =array(); + $returner['code'] = $output; + return $returner; +} + ////////////////////////////////////////////////////////////////////////////////// //WEBWORK FILE RESOLVERS ////////////////////////////////////////////////////////////////////////////////// Index: install.xml =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwquestion/db/install.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -Lwwquestion/db/install.xml -Lwwquestion/db/install.xml -u -r1.4 -r1.5 --- wwquestion/db/install.xml +++ wwquestion/db/install.xml @@ -11,7 +11,8 @@ <FIELD NAME="codecheck" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="question" NEXT="code"/> <FIELD NAME="code" TYPE="text" LENGTH="medium" NOTNULL="true" SEQUENCE="false" ENUM="false" PREVIOUS="codecheck" NEXT="seed"/> <FIELD NAME="seed" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="code" NEXT="trials"/> - <FIELD NAME="trials" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" PREVIOUS="seed"/> + <FIELD NAME="trials" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="1" SEQUENCE="false" ENUM="false" NEXT="grading" PREVIOUS="seed"/> + <FIELD NAME="grading" TYPE="int" LENGTH="10" NUTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" ENUM="false" PREVIOUS="trials"/> </FIELDS> <KEYS> <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="Primary key for question_webwork" NEXT="question"/> Index: qtype_webwork.php =================================================================== RCS file: /webwork/cvs/system/wwmoodle/wwquestion/lang/en_utf8/qtype_webwork.php,v retrieving revision 1.4 retrieving revision 1.5 diff -Lwwquestion/lang/en_utf8/qtype_webwork.php -Lwwquestion/lang/en_utf8/qtype_webwork.php -u -r1.4 -r1.5 --- wwquestion/lang/en_utf8/qtype_webwork.php +++ wwquestion/lang/en_utf8/qtype_webwork.php @@ -20,7 +20,9 @@ $string['edit_codecheck'] = 'Code Checking'; $string['edit_codecheck0'] = 'Turn Off (unadvised)'; $string['edit_codecheck1'] = 'Reject Problem Seeds w/ Errors (silent)'; - $string['edit_codecheck2'] = 'Reject Question if any Errors (strict)'; + $string['edit_codecheck2'] = 'Reject Question if any Errors exist (strict)'; + $string['edit_codecheck3'] = 'Reject Problem Seeds w/ Errors or Warnings (silent)'; + $string['edit_codecheck4'] = 'Reject Question if any Errors or Warnings exist (strict)'; $string['edit_codefile'] = 'Question File'; $string['edit_addcodefiles'] = 'Add More Question Files'; $string['edit_code'] = 'Code'; |