# HG changeset patch # User Nicholas Jillings # Date 1458822579 0 # Node ID 6c6086b0af82af3515aaa6888a50f54feeb0d77a # Parent 419921eae214d77a487ede5511637009d217c8fd Fixed some comment/score parser issues on PHP. diff -r 419921eae214 -r 6c6086b0af82 analysis/index.html --- a/analysis/index.html Thu Mar 24 10:36:38 2016 +0000 +++ b/analysis/index.html Thu Mar 24 12:29:39 2016 +0000 @@ -11,7 +11,7 @@

Charts per test

- +

Charts per test page

diff -r 419921eae214 -r 6c6086b0af82 scripts/comment_parser.php --- a/scripts/comment_parser.php Thu Mar 24 10:36:38 2016 +0000 +++ b/scripts/comment_parser.php Thu Mar 24 12:29:39 2016 +0000 @@ -35,41 +35,43 @@ { // Find the page in the comment_struct $page_struct = null; - foreach($comment_struct as $comment_struct_page) - { - if ($pageInstance['ref'] == $comment_struct_page->id) + if($pageInstance['state'] == "complete") { + foreach($comment_struct as $comment_struct_page) { - $page_struct = $comment_struct_page; - break; - } - } - if ($page_struct == null) { - array_push($comment_struct,new testPage($pageInstance['ref'])); - $page_struct = $comment_struct[count($comment_struct)-1]; - } - // Get the audioelements of the page - foreach($pageInstance->audioelement as $fragment) - { - // Find the page in the comment_struct - $element_struct = null; - foreach($page_struct->elements as $page_struct_element) - { - if ($fragment['name'] == $page_struct_element->id) + if ($pageInstance['ref'] == $comment_struct_page->id) { - $element_struct = $page_struct_element; + $page_struct = $comment_struct_page; break; } } - if ($element_struct == null) { - array_push($page_struct->elements,new audioElement($fragment['name'])); - $element_struct = $page_struct->elements[count($page_struct->elements)-1]; + if ($page_struct == null) { + array_push($comment_struct,new testPage($pageInstance['ref'])); + $page_struct = $comment_struct[count($comment_struct)-1]; } - $element_struct->addComment($fragment->comment->response); + // Get the audioelements of the page + foreach($pageInstance->audioelement as $fragment) + { + // Find the page in the comment_struct + $element_struct = null; + foreach($page_struct->elements as $page_struct_element) + { + if ($fragment['name'] == $page_struct_element->id) + { + $element_struct = $page_struct_element; + break; + } + } + if ($element_struct == null) { + array_push($page_struct->elements,new audioElement($fragment['name'])); + $element_struct = $page_struct->elements[count($page_struct->elements)-1]; + } + $element_struct->addComment($fragment->comment->response); + } } } } } - // Now we have a sub containing all comment data + // Now we have a structure containing all comment data switch($_GET['format']) { case "XML": // Convert to an XML diff -r 419921eae214 -r 6c6086b0af82 scripts/score_parser.php --- a/scripts/score_parser.php Thu Mar 24 10:36:38 2016 +0000 +++ b/scripts/score_parser.php Thu Mar 24 12:29:39 2016 +0000 @@ -73,7 +73,12 @@ // Iterate over each $element node foreach($pageInstance->audioelement as $element) { // Find our specific element tag - $elementId = $element['name']; + $elementId = null; + if (isset($element['name'])) { + $elementId = $element['name']; + } else { + $elementId = $element['ref']; + } $element_nest = $page_nest->findChild($elementId); if ($element_nest == null) { $element_nest = $page_nest->addNewChild($elementId);