Beispiel #1
0
         $score = 3;
     } else {
         if ($trk["sessions"] >= 4 && $hrs >= 2) {
             $score = 2;
         } else {
             if ($trk["sessions"] >= 2 && $hrs >= 1) {
                 $score = 1;
             } else {
                 $score = 0;
             }
         }
     }
 }
 $stud_part = $score;
 $sql = "select w1nlc_math, w2nlc_math, w3nlc_math, w1nlc_uw, w2nlc_uw, w3nlc_uw from progress where user_id={$id} limit 1";
 $prg = rec_as_array(dbExec($sql));
 $n = 0;
 $n += strlen($prg["w1nlc_math"]);
 $n += strlen($prg["w2nlc_math"]);
 $n += strlen($prg["w3nlc_math"]);
 $prob_solve = round($n / 12 * 100);
 if ($prob_solve >= 80) {
     $prob_solve_grade = 4;
 } else {
     if ($prob_solve >= 60) {
         $prob_solve_grade = 3;
     } else {
         if ($prob_solve >= 40) {
             $prob_solve_grade = 2;
         } else {
             if ($prob_solve >= 20) {
Beispiel #2
0
 echo "Compiling scores ...<br>";
 while (!$rsid->EOF) {
     $id = $rsid->fields("id");
     $fname = $rsid->fields("first_name");
     $lname = $rsid->fields("last_name");
     echo $zz + $offset . " - {$fname} {$lname} ({$id}) ";
     // get user's progress rec
     $sql = "select * from progress where user_id={$id}";
     $rs = dbExec($sql);
     if ($rs->RecordCount() < 1) {
         fail("no progress rec for user {$id}");
     }
     if ($rs->RecordCount() > 1) {
         fail("too many progress recs for user {$id}");
     }
     $progress = rec_as_array($rs);
     // turn it into associative array
     // add up score for each category and put into $rslts
     $rslts = array();
     foreach ($mc as $col) {
         if ($col == "user_id") {
             continue;
         }
         $chrs = $progress[$col];
         $n = strlen($chrs);
         for ($i = 0; $i < $n; $i++) {
             $c = substr($chrs, $i, 1);
             $dec = "{$col}{$c}";
             $sr = $scores[$dec];
             if (count($sr) < 1) {
                 if (substr($dec, 2, 4) != "nlc_") {
Beispiel #3
0
function progress_rec($id)
{
    $sql = "select * from progress where user_id={$id} limit 1";
    return rec_as_array(dbExec($sql));
}