';
} else {
//ADD USER ATTEMPTS LIST HERE.
}
$attempts .= ' ';
$sql = "SELECT math_attempts.user_id, score, duration, title FROM `math_attempts` WHERE user_id = '$user_id' AND title LIKE '%X%' AND score >= 90 ORDER BY title,duration ASC, score DESC";
$sql = "select L.user_id,title,minimum_current,minimum_past FROM (select user_id, title, MIN(minimum_current) as minimum_current from ( select user_id, title, AVG( response_time) as minimum_current from math_attempts join math_responses using (aid) where user_id='$user_id' and score >= 90 and title like '%X%' group by aid ) as current group by title ) as L left join (select user_id, title, MIN(minimum_past) as minimum_past from ( select user_id, title, AVG( response_time) as minimum_past from math_attempts join math_responses using (aid) where user_id='$user_id' and score >= 90 and title like '%X%' and `when` < curdate() group by aid ) as current group by title ) as R using (title) order by title";
//echo $sql.' ';
$mult_table_cur = array();
$mult_table_past = array();
$result = mysql_query( $sql );
$prev = '';
for( $i=0; $i <= 12; $i++ ) {
for( $j=0; $j <= 12; $j++ ) {
$mult_table_cur[$i][$j] = 0;
$mult_table_past[$i][$j] = 0;
}
}
$i=0;
while( $row = mysql_fetch_assoc( $result ) ) {
//Unfortunately MYSQL doesn't have a first operator.
if( $prev != $row['title'] ) {
$prev = $row['title'];
$t = explode( 'X', $row['title'] );
$left = explode( ':', $t[0] );
$right = explode( ':', $t[1] );
$nproblems = $left[1] * $right[1];
$g = floor( $row['minimum_current']/1000/$nproblems );
$g = floor( $row['minimum_current']/1000 );
if( $g > 4) {
$g = 4;
}
if( $g < 1) {
$g = 1;
}
$mult_table_cur[ $left[1]][ $right[1] ] = $g;
$g = floor( $row['minimum_past']/1000/$nproblems );
if( $row['minimum_past'] == '' ) {
$g = 0;
} else {
$g = floor( $row['minimum_past']/1000 );
if( $g > 4) {
$g = 4;
}
if( $g < 1) {
$g = 1;
}
}
$mult_table_past[ $left[1]][ $right[1] ] = $g;
}
}
//print_r( $mult_table_past );
//$sql = "SELECT math_attempts.user_id, score, duration, title FROM `math_attempts` WHERE user_id = '$user_id' AND title LIKE '%+%' AND score >= 90 ORDER BY title,duration ASC, score DESC";
//$sql = "select L.user_id,title,minimum_current,minimum_past FROM (select user_id, title, MIN(minimum_current) as minimum_current from ( select user_id, title, AVG( response_time) as minimum_current from math_attempts join math_responses using (aid) where user_id='$user_id' and score >= 90 and qtype = '+' group by aid ) as current group by title ) as L left join (select user_id, title, MIN(minimum_past) as minimum_past from ( select user_id, title, AVG( response_time) as minimum_past from math_attempts join math_responses using (aid) where user_id='$user_id' and score >= 90 and qtype = '+' and `when` < curdate() group by aid ) as current group by title ) as R using (title)";
$sql = "SELECT L.user_id,title,minimum_current,minimum_past ";
$sql .= "FROM (SELECT user_id, title, MIN(minimum_current) as minimum_current FROM ";
$sql .= "( SELECT user_id, title, AVG( response_time) AS minimum_current ";
$sql .= "FROM math_attempts join math_responses using (aid) ";
$sql .= "WHERE user_id='$user_id' AND score >= 90 AND title like '%+%' group by aid ) AS current ";
$sql .= "group by title ) AS L ";
$sql .= "LEFT JOIN (SELECT user_id, title, MIN(minimum_past) AS minimum_past ";
$sql .= "FROM ( SELECT user_id, title, AVG( response_time) AS minimum_past ";
$sql .= "FROM math_attempts join math_responses using (aid) ";
$sql .= "WHERE user_id='$user_id' AND score >= 90 AND title like '%+%' AND `when` < curdate() ";
$sql .= "group by aid ) AS current ";
$sql .= "group by title ) AS R ";
$sql .= "using (title) ";
$sql .= "order by title";
$sql = "select L.user_id,title,minimum_current,minimum_past FROM (select user_id, title, MIN(minimum_current) as minimum_current from ( select user_id, title, AVG( response_time) as minimum_current from math_attempts join math_responses using (aid) where user_id='$user_id' and score >= 90 and title like '%+%' group by aid ) as current group by title ) as L left join (select user_id, title, MIN(minimum_past) as minimum_past from ( select user_id, title, AVG( response_time) as minimum_past from math_attempts join math_responses using (aid) where user_id='$user_id' and score >= 90 and title like '%+%' and `when` < curdate() group by aid ) as current group by title ) as R using (title) order by title";
//echo ''.$sql.'';
$add_table_cur = array();
$add_table_past = array();
$result = mysql_query( $sql );
$prev = '';
for( $i=0; $i <= 12; $i++ ) {
for( $j=0; $j <= 12; $j++ ) {
$add_table_cur[$i][$j] = 0;
$add_table_past[$i][$j] = 0;
}
}
$i=0;
while( $row = mysql_fetch_assoc( $result ) ) {
//Unfortunately MYSQL doesn't have a first operator.
if( $prev != $row['title'] ) {
$prev = $row['title'];
$t = explode( '+', $row['title'] );
$left = explode( ':', $t[0] );
$right = explode( ':', $t[1] );
$nproblems = $left[1] * $right[1];
//$g = floor( $row['minimum_current']/1000/$nproblems );
$g = floor( $row['minimum_current']/1000 );
//echo $row['minimum_current'].' '.$g.' ';
if( $g > 4) {
$g = 4;
}
if( $g < 1) {
$g = 1;
}
$add_table_cur[ $left[1]][ $right[1] ] = $g;
/*
$g = floor( $row['minimum_past']/1000/$nproblems );
$g = floor( $row['minimum_past']/1000);
if( $g > 4) {
$g = 4;
}
if( $g < 1) {
$g = 1;
}
*/
if( $row['minimum_past'] == '' ) {
$g = 0;
} else {
$g = floor( $row['minimum_past']/1000 );
if( $g > 4) {
$g = 4;
}
if( $g < 1) {
$g = 1;
}
}
$add_table_past[ $left[1]][ $right[1] ] = $g;
}
}
//echo var_dump( $add_table_past );
//echo var_dump( $add_table_cur );
?>
ASchool.us's Math Facts Service
MathFacts Menu:
if( !$loggedin ) {
?>
Math Facts empowering students and teachers to learn more efficiently.
Check out the new version here Apps@ASchool.us. The new version includes subtraction and division. If you already have an account in the old version you can also use it to log into the new version.
Check out the help page to get a feel for what it looks like.
Teacher Menu: Reports Grid Report Class Roster CSV Data: Comma separated format that can be imported to Access, Excel or any other spreadsheet or database program. This will allow you to make your own custom reports. Times in this format are accurate to the hundredth of a second.