Permalink
Browse files

Add problem selection to log analysis, various bug fixes.

  • Loading branch information...
1 parent adb312e commit f46e1c06fed67df430e44207bb461ac16edf9c63 @bvds committed Jun 13, 2012
View
@@ -193,7 +193,7 @@
(defun qvars->indyVars (Qvars)
"Given a list of qvars generate the indyVars for the independence system."
(loop for Q in Qvars
- when (not (null (Qvar-Value Q)))
+ when (Qvar-Value Q)
collect (qvar->indyvar Q)))
(defun qvar->indyvar (Qvar)
@@ -36,6 +36,7 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
$startDate = $_POST['startDate'];
$endDate = $_POST['endDate'];
$errorType=$_POST['errorType'];
+$problem=$_POST['problem'];
if($startDate){
$startDatec = "P1.startTime >= '$startDate' AND";
@@ -48,10 +49,15 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
$endDatec = "";
}
if($errorType){
- $errorTypec = "\"$errorType\"";
+ $errorTypec = "P2.server REGEXP '\"error-type\":\"$errorType\"' AND";
} else {
$errorTypec = "";
}
+ if($problem){
+ $problemc = "P1.userProblem = '$problem' AND";
+ } else {
+ $problemc = "";
+ }
echo "<h2>The Errors and Warnings are as given below:</h2>";
echo "<table border=1>\n";
@@ -65,8 +71,9 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
set_time_limit(300);
$json = new Services_JSON();
-$sqlOld="SELECT startTime,userName,userProblem,userSection,tID,command,P1.clientID from $problem_attempt AS P1,PROBLEM_ATTEMPT_TRANSACTION AS P2 WHERE $startDatec $endDatec P2.initiatingParty='server' AND P2.command like '%\"error-type\":$errorTypec%' AND P2.command like '%\"error\":%' AND P2.clientID=P1.clientID AND P1.extra=0 order by P2.tID";
-$sql="SELECT startTime,userName,userProblem,userSection,tID,client,server,P1.clientID from $problem_attempt AS P1,STEP_TRANSACTION AS P2 WHERE $startDatec $endDatec P2.server like '%\"log\":\"server\"%' AND P2.clientID=P1.clientID AND (P1.extra IS NULL OR P1.extra=0) order by P2.tID";
+$sqlOld="SELECT startTime,userName,userProblem,userSection,tID,command,P1.clientID from $problem_attempt AS P1,PROBLEM_ATTEMPT_TRANSACTION AS P2 WHERE $startDatec $endDatec $problemc $errorTypec P2.initiatingParty='server' AND P2.command like '%\"error\":%' AND P2.clientID=P1.clientID AND P1.extra=0 order by P2.tID";
+$sql="SELECT startTime,userName,userProblem,userSection,tID,client,server,P1.clientID from $problem_attempt AS P1,STEP_TRANSACTION AS P2 WHERE $startDatec $endDatec $problemc $errorTypec P2.server like '%\"log\":\"server\"%' AND P2.clientID=P1.clientID AND (P1.extra IS NULL OR P1.extra=0) order by P2.tID";
+// echo "<pre>$sql</pre><br>\n";
$resultOld=mysql_query($sqlOld);
$result=mysql_query($sql);
$ecount=0;
@@ -152,7 +159,7 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
echo "<td rowspan=\"$nr\">$aa</td>";
echo array_shift($yy);
- echo "<td rowspan=\"$nr\"><a href=\"javascript:;\" onclick=\"openTrace('OpenTrace.php?x=$dbuser&amp;sv=$dbserver&amp;pwd=$dbpass&amp;d=$dbname&amp;cid=$clientID&amp;u=$userName&amp;p=$userProblem&amp;s=$userSection&amp;t=$ttID');\">Session&nbsp;log</a><br><a href=\"javascript:;\" onclick=\"copyRecord('\Save.php?x=$dbuser&amp;sv=$dbserver&amp;pwd=$dbpass&amp;d=$dbname&amp;a=$adminName&amp;a=$adminName&amp;u=$userName&amp;p=$userProblem&amp;s=$userSection&amp;t=$usertID');\">Solution</a></td></tr>\n";
+ echo "<td rowspan=\"$nr\"><a href=\"javascript:;\" onclick=\"openTrace('OpenTrace.php?x=$dbuser&amp;sv=$dbserver&amp;pwd=$dbpass&amp;d=$dbname&amp;cid=$clientID&amp;u=$userName&amp;p=$userProblem&amp;s=$userSection&amp;t=$ttID');\">Session&nbsp;log</a><br><a href=\"javascript:;\" onclick=\"copyRecord('\Save.php?x=$dbuser&amp;sv=$dbserver&amp;pwd=$dbpass&amp;d=$dbname&amp;a=$adminName&amp;a=$adminName&amp;&cid=$clientID&u=$userName&amp;p=$userProblem&amp;s=$userSection&amp;t=$usertID');\">Copy&nbsp;Session</a></td></tr>\n";
foreach ($yy as $bb) {
echo "<tr class=\"$method\">$bb</tr>\n";
@@ -31,6 +31,7 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
mysql_select_db($dbname)
or die ("UNABLE TO SELECT DATABASE");
+$problem = $_POST['problem'];
$adminName = $_POST['adminName'];
$sectionName = $_POST['sectionName'];
$orderBy = $_POST['item'];
@@ -45,6 +46,11 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
$order = "DESC";
else
$order = "";
+if($problem==''){
+ $problemc = "";
+ } else {
+ $problemc = "P1.userProblem REGEXP '$problem' AND";
+ }
if($adminName==''){
$adminNamec = "";
$adminNamee = "";
@@ -86,9 +92,9 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
echo "<h2>Comments in problems $extrae,$adminNamee$sectionNamee sorted in $order order of $orderBy</h2>\n";
- $sqlOld = "SELECT * FROM $problem_attempt AS P1,PROBLEM_ATTEMPT_TRANSACTION AS P2 WHERE $adminNamec $sectionNamec $extrac $startDatec $endDatec P1.clientID = P2.clientID AND P2.initiatingParty = 'client' AND P2.command LIKE '%\"action\":\"get-help\",\"text\":%' ORDER BY $orderBy $order";
- $sql = "SELECT * FROM $problem_attempt AS P1,STEP_TRANSACTION AS P2 WHERE $adminNamec $sectionNamec $extrac $startDatec $endDatec P1.clientID = P2.clientID AND P2.client LIKE '%\"action\":\"get-help\",\"text\":%' ORDER BY $orderBy $order";
-
+ $sqlOld = "SELECT * FROM $problem_attempt AS P1,PROBLEM_ATTEMPT_TRANSACTION AS P2 WHERE $problemc $adminNamec $sectionNamec $extrac $startDatec $endDatec P1.clientID = P2.clientID AND P2.initiatingParty = 'client' AND P2.command LIKE '%\"action\":\"get-help\",\"text\":%' ORDER BY $orderBy $order";
+ $sql = "SELECT * FROM $problem_attempt AS P1,STEP_TRANSACTION AS P2 WHERE $problemc $adminNamec $sectionNamec $extrac $startDatec $endDatec P1.clientID = P2.clientID AND P2.client LIKE '%\"action\":\"get-help\",\"text\":%' ORDER BY $orderBy $order";
+
$resultOld = mysql_query($sqlOld);
$result = mysql_query($sql);
if (($myrow = mysql_fetch_array($result)) ||
@@ -136,7 +142,7 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
echo "<h2>Problems $extrae,$adminNamee$sectionNamee sorted in $order order of $orderBy</h2>\n";
- $sql = "SELECT * FROM $problem_attempt AS P1 WHERE $adminNamec $sectionNamec $extrac $startDatec $endDatec P1.clientID = P1.clientID ORDER BY $orderBy $order";
+ $sql = "SELECT * FROM $problem_attempt AS P1 WHERE $problemc $adminNamec $sectionNamec $extrac $startDatec $endDatec P1.clientID = P1.clientID ORDER BY $orderBy $order";
// echo "mysql query \"$sql\"\n";
@@ -183,7 +189,7 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
echo "<h2>Student errors in problems $extrae,$adminNamee$sectionNamee sorted by time of confusion</h2>\n";
// Doesn't need order, but useful for debugging.
- $sql = "SELECT * FROM $problem_attempt AS P1 WHERE $adminNamec $sectionNamec $extrac $startDatec $endDatec P1.clientID = P1.clientID ORDER BY $orderBy $order";
+ $sql = "SELECT * FROM $problem_attempt AS P1 WHERE $problemc $adminNamec $sectionNamec $extrac $startDatec $endDatec P1.clientID = P1.clientID ORDER BY $orderBy $order";
$queryStart=microtime(true);
$result = mysql_query($sql);
$queryTime += microtime(true)-$queryStart;
@@ -360,7 +366,7 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
echo "<p>Record only the initial user agent string for each user since\n";
echo "students may change browser based on an initial bad experience.\n";
- $sql = "SELECT * FROM $problem_attempt AS P1 WHERE $adminNamec $sectionNamec $extrac $startDatec $endDatec P1.clientID = P1.clientID ORDER BY startTime";
+ $sql = "SELECT * FROM $problem_attempt AS P1 WHERE $problemc $adminNamec $sectionNamec $extrac $startDatec $endDatec P1.clientID = P1.clientID ORDER BY startTime";
$queryStart=microtime(true);
$result = mysql_query($sql);
$queryTime += microtime(true)-$queryStart;
@@ -38,6 +38,9 @@
</select> (not used for Student Errors)
<p>
+<label>Optional problem</label>:&nbsp;
+ <input name="problem" type="text" >
+ (<a href="http://en.wikipedia.org/wiki/Regular_expression">POSIX extended regexp</a>)<br>
<label>Optional User Name</label>:&nbsp;
<input name="adminName" type="text" >
(<a href="http://en.wikipedia.org/wiki/Regular_expression">POSIX extended regexp</a>)<br>
@@ -31,9 +31,11 @@
<form name="ErrorForm" action="ErrorProcessing.php" method="post">
<label>User Name</label>:&nbsp;
- <input name="adminName" type="text" /><br>
-<label>Filter by error type</label>:&nbsp;
- <input name="errorType" type="text" size="8"/><br>
+ <input name="adminName" type="text" /> (for new sessions)<br>
+<label>Optional by error type</label>:&nbsp;
+ <input name="errorType" type="text" size="8"/> (<a href="http://en.wikipedia.org/wiki/Regular_expression">POSIX extended regexp</a>)<br>
+<label>Optional problem name</label>:&nbsp;
+ <input name="problem" type="text" size="8"/><br>
<label>Optional dates (format 2010-06-11)</label>:&nbsp;
from <input name="startDate" type="text" size="8"/> to
<input name="endDate" type="text" size="8"/><br>
@@ -81,8 +81,8 @@ function_exists('mysql_connect') or die ("Missing mysql extension");
//
$sectionName = '^asu_7e256268bab914fb5asul1_' ; //$_POST['sectionName'];
// '2011-04-01'
-$startDate = '2012-01-20'; // $_POST['startDate'];
-$endDate = ''; // $_POST['endDate'];
+$startDate = ''; // $_POST['startDate'];
+$endDate = '2012-06-04 00:00:00'; // $_POST['endDate'];
$methods = array('open-problem','solution-step','seek-help','record-action','close-problem'); //implode(",",$_POST['methods']);
if($adminName==''){
@@ -424,7 +424,7 @@ function doneButtonProblem ($p){
// Position of first discrepency
$pos=strspn($response ^ $newResponse, "\0");
if($njr==null){
- fwrite($handle2,$tid . ': ' . $newResponse . "\n");
+ fwrite($handle2,$ttID . ': ' . $newResponse . "\n");
}
echo "<tr class='syntax'><td>$aaa</td><td>$aa</td>" .
"<td>" . ($jr== null?"json decode failed":"OK") .

0 comments on commit f46e1c0

Please sign in to comment.