|
37 | 37 |
|
38 | 38 | // Query db for answers |
39 | 39 | if ($answer_type == HOT_SPOT_DELINEATION) { |
40 | | - $sql = "SELECT iid, id, answer, hotspot_coordinates, hotspot_type, ponderation |
| 40 | + $sql = "SELECT iid, id, answer, hotspot_coordinates, hotspot_type, ponderation |
41 | 41 | FROM $TBL_ANSWERS |
42 | | - WHERE |
43 | | - c_id = $course_id AND |
44 | | - question_id = $questionId AND |
45 | | - hotspot_type = 'delineation' |
| 42 | + WHERE |
| 43 | + c_id = $course_id AND |
| 44 | + question_id = $questionId AND |
| 45 | + hotspot_type = 'delineation' |
46 | 46 | ORDER BY iid"; |
47 | 47 | } else { |
48 | | - $sql = "SELECT iid, id, answer, hotspot_coordinates, hotspot_type, ponderation |
| 48 | + $sql = "SELECT iid, id, answer, hotspot_coordinates, hotspot_type, ponderation |
49 | 49 | FROM $TBL_ANSWERS |
50 | | - WHERE c_id = $course_id AND question_id = $questionId |
| 50 | + WHERE c_id = $course_id AND question_id = $questionId |
51 | 51 | ORDER BY position"; |
52 | 52 | } |
53 | 53 | $result = Database::query($sql); |
|
118 | 118 | $data['hotspots'][] = $hotSpot; |
119 | 119 | } |
120 | 120 |
|
121 | | -$attemptList = Event::getAllExerciseEventByExeId($exerciseId); |
| 121 | +$attemptInfo = Database::select( |
| 122 | + 'exe_id', |
| 123 | + Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES), |
| 124 | + [ |
| 125 | + 'where' => [ |
| 126 | + 'exe_exo_id = ? AND c_id = ? AND exe_user_id = ? AND status = ?' => [ |
| 127 | + (int) $exerciseId, |
| 128 | + $course_id, |
| 129 | + api_get_user_id(), |
| 130 | + 'incomplete', |
| 131 | + ] |
| 132 | + ], |
| 133 | + 'order' => 'exe_id DESC', |
| 134 | + 'limit' => 1, |
| 135 | + ], |
| 136 | + 'first' |
| 137 | +); |
| 138 | + |
| 139 | +if (empty($attemptInfo)) { |
| 140 | + exit(0); |
| 141 | +} |
| 142 | + |
| 143 | +$attemptList = Event::getAllExerciseEventByExeId($attemptInfo['exe_id']); |
122 | 144 |
|
123 | 145 | if (!empty($attemptList)) { |
124 | 146 | if (isset($attemptList[$questionId])) { |
|
0 commit comments