From: Simon H. <sim...@us...> - 2010-09-29 15:36:15
|
Update of /cvsroot/stack/stack-dev/lib/reporting In directory sfp-cvsdas-3.v30.ch3.sourceforge.com:/tmp/cvs-serv2148/lib/reporting Modified Files: Tag: STACK2_2 DiagnosticReport.php Log Message: Interim development. Index: DiagnosticReport.php =================================================================== RCS file: /cvsroot/stack/stack-dev/lib/reporting/Attic/DiagnosticReport.php,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -C2 -d -r1.1.2.12 -r1.1.2.13 *** DiagnosticReport.php 1 Sep 2010 16:51:00 -0000 1.1.2.12 --- DiagnosticReport.php 29 Sep 2010 15:36:04 -0000 1.1.2.13 *************** *** 79,82 **** --- 79,83 ---- //$this->logger->debug(print_r($skillsResources->getResourcesForSkills(array('EQN-SIM')), 1)); //$subskills = array('EQN-SIM'); + $this->logger->debug("subskills:".print_r($subskills,1)); $resources = $skillsResources->getResourcesForSkills($subskills); *************** *** 127,130 **** --- 128,132 ---- // going and getting those answer notes $answerNotes = $this->traverseAnswerNotes($attempts); + //$answerNotes = array(end($answerNotes));// take last answer only //$out .= "<br>Collated answer notes: ".print_r($answerNotes, 1); *************** *** 132,138 **** foreach($answerNotes as $note) { //$out .= "answernote:".print_r($answer,1); ! preg_match("|diagnostic:(.*)|sxi", $note, $m); if(!empty($m)) { ! $changes = explode(',', $m[1]); //$this->logger->debug("CHANGES:".print_r($changes,1)); foreach($changes as $change) { // each skill mark --- 134,141 ---- foreach($answerNotes as $note) { //$out .= "answernote:".print_r($answer,1); ! //preg_match("|diagnostic:(.*)|sxi", $note, $m); // indentifier now optional ! $m = preg_replace('|diagnostic:|sxi', '', $note); if(!empty($m)) { ! $changes = explode(',', $m);//$m[1]); //$this->logger->debug("CHANGES:".print_r($changes,1)); foreach($changes as $change) { // each skill mark *************** *** 155,158 **** --- 158,168 ---- } + // assuming format aaa-[true|false] + else if(preg_match("/^([a-z]{3})-(true|false)/xi", $change, $m)) { + //$this->logger->debug("M:".print_r($m,1)); + if($m[2] == 'TRUE') $value = 1; + elseif($m[2] == 'FALSE') $value = -1; + $profile[$m[1]][$m[1]] += $value; + } } } *************** *** 195,199 **** axes: { xaxis:{renderer:$.jqplot.CategoryAxisRenderer, ticks:[".implode(',',$labels)."]}, ! yaxis:{padMax:1.3, padMin:1.3, autoscale:false, numberTicks:0, showTicks:false} } //,title: { text: '".$this->getString($skill)."' }, --- 205,209 ---- axes: { xaxis:{renderer:$.jqplot.CategoryAxisRenderer, ticks:[".implode(',',$labels)."]}, ! yaxis:{padMax:1.3, padMin:1.3, autoscale:true, numberTicks:1, showTicks:false, ticks:[-10, 0, 10]} } //,title: { text: '".$this->getString($skill)."' }, *************** *** 205,209 **** // textual feedback ! $out .= "<h3>Feedback</h3>"; foreach($subskill as $label => $value) { $out .= $this->getString($label).': '.$value.'<br />'; --- 215,219 ---- // textual feedback ! $out .= "<h3>Raw Scores</h3>"; foreach($subskill as $label => $value) { $out .= $this->getString($label).': '.$value.'<br />'; *************** *** 245,291 **** // and quiz // or just quiz? ! $mdb = new MoodleDB(); $mdb->connect(); // Remember: this is initially a student-centric report card! ! //$this->logger->debug("quizAttempts:".print_r($quizAttempts, 1)); // get all responses // for each quiz that has been attempted, get the response sequence that comprises that attempt - foreach($quizAttempts as $quiz => $attempts) { - foreach($attempts as $attempt) { - $attemptResponses = $mdb->getAttemptResponses($attempt); - //$this->logger->debug("attemptResponses:".print_r($attemptResponses, 1)); - $responses[$attempt] = $attemptResponses['responses']; - $versionForAttempt[$attempt] = $attemptResponses['version']; - } - } ! // will need some db objects... ! $cache = new StackDBCache(); ! $cache->connect(); ! $prtMetaDB = new StackDBAttemptPRTMeta(); ! $prtMetaDB->connect(); ! // parse responses for each attempt and use to traverse the cache, collating the answer notes - either last or all ! foreach($responses as $attempt => $sequence) { // get initial state using randomseed and questionid ! preg_match('|__randomseed-(\d+)|',$sequence[0]['answer'], $match); $seed = $match[1]; ! $state = $cache->selectInitialState($seed, $versionForAttempt[$attempt]); ! // iterate through sucessive cache states with parsed responses, collating answernotes $seqNumber = 1; ! while($state != NULL) { ! $step = $sequence[$seqNumber++]; // decode the response into a post $encodedResponse = $step['answer']; $encodedArray = preg_split('/(?<!\\\\)\,/', $encodedResponse); // Split the responses on non-backslash-escaped commas. $post = array(); foreach($encodedArray as $e) { list($key, $value) = explode('-', $e, 2); $post[$key] = str_replace('\\\\,', ',', $value); --- 255,308 ---- // and quiz // or just quiz? ! $out = array(); $mdb = new MoodleDB(); $mdb->connect(); + // will need some db objects... + $cache = new StackDBCache(); + $cache->connect(); + $prtMetaDB = new StackDBAttemptPRTMeta(); + $prtMetaDB->connect(); // Remember: this is initially a student-centric report card! ! $this->logger->debug("quizAttempts:".print_r($quizAttempts, 1)); // get all responses // for each quiz that has been attempted, get the response sequence that comprises that attempt ! foreach($quizAttempts as $quiz => $quizAttempt) { // for each quiz in scope, get attempts ! foreach($quizAttempt as $questionAttempts) { // for each quiz attempt ! // $attemptResponses = $mdb->getAttemptResponses($quizAttempt); ! // $this->logger->debug("attemptResponses:".print_r($attemptResponses, 1)); ! // $responses[$quizAttempt] = $attemptResponses['responses']; ! // $versionForAttempt[$quizAttempt] = $attemptResponses['version']; ! $questionResponses = $mdb->getQuestionAttemptResponses($questionAttempts); ! // } ! // } ! // parse responses for each attempt and use to traverse the cache, collating the answer notes - either last or all - question by question ! // attemptResponses would be better named questionResponses ! //$responses ! $this->logger->debug("questionResponses:".print_r($questionResponses, 1)); ! foreach($questionResponses as $question => $response) { // get initial state using randomseed and questionid ! preg_match('|__randomseed-(\d+)|',$response[0]['answer'], $match); $seed = $match[1]; ! $state = $cache->selectInitialState($seed, $response['version']); ! $this->logger->debug("init state: $state"); // iterate through sucessive cache states with parsed responses, collating answernotes $seqNumber = 1; ! while(isset($response[$seqNumber])) {// $state != NULL or isset($response[$seqNumber]) ! $this->logger->debug("one step beyond:".print_r($response[$seqNumber], 1)); ! $step = $response[$seqNumber++]; // decode the response into a post $encodedResponse = $step['answer']; + $this->logger->debug('encodedResponse = '.$encodedResponse); $encodedArray = preg_split('/(?<!\\\\)\,/', $encodedResponse); // Split the responses on non-backslash-escaped commas. $post = array(); foreach($encodedArray as $e) { + // $this->logger->debug("e = $e"); list($key, $value) = explode('-', $e, 2); $post[$key] = str_replace('\\\\,', ',', $value); *************** *** 294,316 **** // temporarily insert event to map it $post['event'] = $step['event']; $event = MoodleDisplayItem::mapStackEvent($post); unset($post['event']); unset($post['stackaction']); $transition = $cache->nextTransition($state, $post, $event); ! $state = $cache->nextNode($transition); ! //$this->logger->debug("post: ".print_r($post,1)." with event: $event from state: $oldstate goes to state $state"); $details = $prtMetaDB->getAttemptDetails($state); // get the answer notes from potentially more than one PRT foreach($details as $detail) { $out[] = $detail['AnsNote']; } } ! } // return array of answernotes return $out; } } ! ?> \ No newline at end of file --- 311,347 ---- // temporarily insert event to map it $post['event'] = $step['event']; + $this->logger->debug('moodle event'.$post['event']); $event = MoodleDisplayItem::mapStackEvent($post); + $this->logger->debug("mapped post=".print_r($post,1)); unset($post['event']); unset($post['stackaction']); $transition = $cache->nextTransition($state, $post, $event); ! $oldstate = $state; $state = $cache->nextNode($transition); ! //if($state === NULL) $this->logger->critical("STATE IS NULL!"); ! $this->logger->debug("post: ".print_r($post,1)." with event: $event from state: $oldstate goes to state $state"); $details = $prtMetaDB->getAttemptDetails($state); // get the answer notes from potentially more than one PRT + unset($notes);// = array(); foreach($details as $detail) { + $notes[] = $detail['AnsNote']; $out[] = $detail['AnsNote']; } + $this->logger->debug("notes=".print_r($notes, 1)); + //$this->logger->debug("$notes=".print_r($notes, 1)); + //$merge = array_merge($out, $notes); // assuming ALL results } ! ! $merge = array_merge($merge, $notes); ! $this->logger->debug("merge=".print_r($notes, 1)); ! } ! } ! }//*/ // return array of answernotes + return $out; } } ! ?> |