252 $result = $this->db->query(
254 SELECT COUNT(tst_pass_result.workingtime) cnt 255 FROM object_reference 256 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi 257 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi 258 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi 259 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi 260 AND tst_pass_result.pass = tst_result_cache.pass 261 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi 262 WHERE object_reference.ref_id = ' . $this->db->quote($a_test_ref_id,
'integer') .
' 263 AND tst_active.user_fi != ' . $this->db->quote($a_user_id,
'integer') .
' 264 AND round(reached_points/max_points*100) >= 266 SELECT round(reached_points/max_points*100) 267 FROM object_reference 268 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi 269 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi 270 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi 271 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi 272 AND tst_pass_result.pass = tst_result_cache.pass 273 WHERE object_reference.ref_id = ' . $this->db->quote($a_test_ref_id,
'integer') .
' 274 AND tst_active.user_fi = ' . $this->db->quote($a_user_id,
'integer') .
' 278 $row = $this->db->fetchAssoc($result);
279 $better_participants = $row[
'cnt'];
280 $own_placement = $better_participants + 1;
282 $result = $this->db->query(
284 SELECT COUNT(tst_pass_result.workingtime) cnt 285 FROM object_reference 286 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi 287 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi 288 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi 289 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi 290 AND tst_pass_result.pass = tst_result_cache.pass 291 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi 292 WHERE object_reference.ref_id = ' . $this->db->quote($a_test_ref_id,
'integer')
294 $row = $this->db->fetchAssoc($result);
295 $number_total = $row[
'cnt'];
297 $result = $this->db->query(
299 SELECT tst_result_cache.*, round(reached_points/max_points*100) as percentage , 300 tst_pass_result.workingtime, usr_id, usr_data.firstname, usr_data.lastname 301 FROM object_reference 302 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi 303 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi 304 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi 305 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi 306 AND tst_pass_result.pass = tst_result_cache.pass 307 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi 309 WHERE object_reference.ref_id = ' . $this->db->quote($a_test_ref_id,
'integer') .
' 310 AND tst_active.user_fi = ' . $this->db->quote($a_user_id,
'integer') .
' 313 SELECT tst_result_cache.*, round(reached_points/max_points*100) as percentage, 314 tst_pass_result.workingtime, usr_id, usr_data.firstname, usr_data.lastname 315 FROM object_reference 316 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi 317 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi 318 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi 319 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi 320 AND tst_pass_result.pass = tst_result_cache.pass 321 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi 322 WHERE object_reference.ref_id = ' . $this->db->quote($a_test_ref_id,
'integer') .
' 323 AND tst_active.user_fi != ' . $this->db->quote($a_user_id,
'integer') .
' 324 AND round(reached_points/max_points*100) >= 326 SELECT round(reached_points/max_points*100) 327 FROM object_reference 328 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi 329 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi 330 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi 331 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi 332 AND tst_pass_result.pass = tst_result_cache.pass 333 WHERE object_reference.ref_id = ' . $this->db->quote($a_test_ref_id,
'integer') .
' 334 AND tst_active.user_fi = ' . $this->db->quote($a_user_id,
'integer') .
' 336 ORDER BY round(reached_points/max_points*100) ASC 337 LIMIT 0, ' . $this->db->quote($this->
object->getHighscoreTopNum(),
'integer') .
' 340 SELECT tst_result_cache.*, round(reached_points/max_points*100) as percentage, 341 tst_pass_result.workingtime, usr_id, usr_data.firstname, usr_data.lastname 342 FROM object_reference 343 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi 344 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi 345 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi 346 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi 347 AND tst_pass_result.pass = tst_result_cache.pass 348 INNER JOIN usr_data ON usr_data.usr_id = tst_active.user_fi 349 WHERE object_reference.ref_id = ' . $this->db->quote($a_test_ref_id,
'integer') .
' 350 AND tst_active.user_fi != ' . $this->db->quote($a_user_id,
'integer') .
' 351 AND round(reached_points/max_points*100) <= 353 SELECT round(reached_points/max_points*100) 354 FROM object_reference 355 INNER JOIN tst_tests ON object_reference.obj_id = tst_tests.obj_fi 356 INNER JOIN tst_active ON tst_tests.test_id = tst_active.test_fi 357 INNER JOIN tst_result_cache ON tst_active.active_id = tst_result_cache.active_fi 358 INNER JOIN tst_pass_result ON tst_active.active_id = tst_pass_result.active_fi 359 AND tst_pass_result.pass = tst_result_cache.pass 360 WHERE object_reference.ref_id = ' . $this->db->quote($a_test_ref_id,
'integer') .
' 361 AND tst_active.user_fi = ' . $this->db->quote($a_user_id,
'integer') .
' 363 ORDER BY round(reached_points/max_points*100) ASC 364 LIMIT 0, ' . $this->db->quote($this->
object->getHighscoreTopNum(),
'integer') .
' 366 ORDER BY round(reached_points/max_points*100) DESC, tstamp ASC 367 LIMIT 0, ' . $this->db->quote($this->object->getHighscoreTopNum(),
'integer') .
' 371 $i = $own_placement - ($better_participants >= $this->
object->getHighscoreTopNum()
372 ? $this->
object->getHighscoreTopNum() : $better_participants);
381 while ($row = $this->db->fetchAssoc($result)) {
387 if ($number_total > $i) {
getResultTableRow(array $row, int $i, int $usrId)