[svn r17909] Logic change - Fixed score in exercise y lp into tracking and implemented qualify exercise attempts in learning path details - see FS#3479
if (isset($_GET['lp_id']) && isset($_GET['my_lp_id'])) {
if ($origin != 'tracking') {
$sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . (int)$row['path'] . '" AND exe_user_id="' . (int)api_get_user_id() . '" AND orig_lp_id = "'.(int)$_GET['lp_id'].'" AND orig_lp_item_id = "'.(int)$_GET['my_lp_id'].'" AND exe_cours_id="' . Database :: escape_string($course_code) . '" AND status <> "incomplete" ORDER BY exe_date';
} else {
$sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . (int)$row['path'] . '" AND exe_user_id="' . (int)$_GET['student_id'] . '" AND orig_lp_id = "'.(int)$_GET['lp_id'].'" AND orig_lp_item_id = "'.(int)$_GET['my_lp_id'].'" AND exe_cours_id="' . Database :: escape_string($course_code) . '" AND status <> "incomplete" ORDER BY exe_date';
}
} else {
if ($origin != 'tracking') {
$sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . (int)$row['path'] . '" AND exe_user_id="' . (int)api_get_user_id() . '" AND orig_lp_id = "'.(int)$lp_id.'" AND orig_lp_item_id = "'.(int)$row['myid'].'" AND exe_cours_id="' . Database :: escape_string($course_code) . '" AND status <> "incomplete" ORDER BY exe_date';
} else {
$sql_attempts = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . (int)$row['path'] . '" AND exe_user_id="' . (int)$_GET['student_id'] . '" AND orig_lp_id = "'.(int)$lp_id.'" AND orig_lp_item_id = "'.(int)$row['myid'].'" AND exe_cours_id="' . Database :: escape_string($course_code) . '" AND status <> "incomplete" ORDER BY exe_date';
if ($origin != 'tracking' && $origin != 'tracking_course') {
if ($origin != 'tracking' && $origin != 'tracking_course') {
$sql_last_attempt = 'SELECT exe_id FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . api_get_user_id() . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . $course_code . '" AND status <> "incomplete" ORDER BY exe_date ASC';
$sql_last_attempt = 'SELECT exe_id FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . api_get_user_id() . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . $course_code . '" AND status <> "incomplete" ORDER BY exe_date DESC ';
} else {
} else {
$sql_last_attempt = 'SELECT exe_id FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . Database :: escape_string($_GET['student_id']) . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . Database :: escape_string($_GET['course']) . '" AND status <> "incomplete" ORDER BY exe_date';
$sql_last_attempt = 'SELECT exe_id FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . Database :: escape_string($_GET['student_id']) . '" AND orig_lp_id = "'.$lp_id.'" AND orig_lp_item_id = "'.$row['myid'].'" AND exe_cours_id="' . Database :: escape_string($_GET['course']) . '" AND status <> "incomplete" ORDER BY exe_date DESC ';