Count solved exercices

This commit is contained in:
Némunaire 2015-01-18 22:23:53 +01:00 committed by Nemunaire
commit 05bc4c605c

View file

@ -216,16 +216,18 @@ class Team
function get_solved_exercices($id_theme=-1) function get_solved_exercices($id_theme=-1)
{ {
if ($id_theme != -1) $array = array();
{
global $db; global $db;
if ($id_theme != -1)
$ids = $db->query("SELECT `id_theme`, `id_exercice` $ids = $db->query("SELECT `id_theme`, `id_exercice`
FROM solved S FROM solved S
LEFT OUTER JOIN exercices E ON S.id_exercice = E.id LEFT OUTER JOIN exercices E ON S.id_exercice = E.id
WHERE id_team =".$this->id." AND id_theme =".$id_theme); WHERE id_team =".$this->id." AND id_theme =".$id_theme);
else
$array = array(); $ids = $db->query("SELECT `id_theme`, `id_exercice`
$i = 0; FROM solved S
LEFT OUTER JOIN exercices E ON S.id_exercice = E.id
WHERE id_team =".$this->id);
if ($ids) if ($ids)
{ {
foreach ($ids as $id) foreach ($ids as $id)
@ -234,8 +236,6 @@ class Team
return $array; return $array;
} }
return NULL;
}
// Static methods // Static methods
public static function set_revoked($bool, $name) public static function set_revoked($bool, $name)