From b61d96f5377fcb0bf3ee3735a1281c5c44d106b8 Mon Sep 17 00:00:00 2001
From: cortylal <alexcortyl@gmail.com>
Date: Thu, 19 Jun 2014 02:52:24 +0200
Subject: [PATCH] stats

---
 class/stats.php | 2 ++
 view/stats.php  | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/class/stats.php b/class/stats.php
index 03e3fd9..c98edb0 100644
--- a/class/stats.php
+++ b/class/stats.php
@@ -174,6 +174,7 @@ class Stats
                                                 FROM animal a, race r
                                                 WHERE a.race = r.id
                                                 GROUP BY r.nom, r.id
+                                                ORDER BY count DESC
                                                 LIMIT 10" ); // on prépare notre requête
         $requete_prepare->execute();
 
@@ -192,6 +193,7 @@ class Stats
                                                 WHERE a.race = r.id
                                                 AND e.id = r.espece
                                                 GROUP BY e.nom, e.id
+                                                ORDER BY count DESC
                                                 LIMIT 10" ); // on prépare notre requête
         $requete_prepare->execute();
 
diff --git a/view/stats.php b/view/stats.php
index a61a836..7d97279 100644
--- a/view/stats.php
+++ b/view/stats.php
@@ -143,7 +143,7 @@
                 <th>Nombre d'individu </th> 
         </thead>
           <tbody>
-          <?php foreach ($stats->top10Race) as $ligne): ?>
+          <?php foreach ($stats->top10Race as $ligne): ?>
             <tr>
                 <td><?php echo $ligne["nom"]; ?> </td>
                 <td><?php echo $ligne["count"]; ?> </td> 
-- 
GitLab