From f241e7ecf971bed002da474e3bcac5d9cf877510 Mon Sep 17 00:00:00 2001
From: Erich Eckner <git@eckner.net>
Date: Tue, 10 Jul 2018 14:33:03 +0200
Subject: packages/index.php: fix column types

---
 packages/index.php | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

(limited to 'packages/index.php')

diff --git a/packages/index.php b/packages/index.php
index 1347aa9..08c7048 100644
--- a/packages/index.php
+++ b/packages/index.php
@@ -37,6 +37,11 @@ require_once BASE . "/lib/format.php";
       $multi_select_search_criteria[$criterium]["values"][] = $row["name"];
   }
 
+  $float_columns = array(
+    "has_issues",
+    "is_to_be_deleted"
+  );
+
   $filter = " WHERE 1";
   foreach ($multi_select_search_criteria as $criterium)
     if (isset($_GET[$criterium["name"]])) {
@@ -131,8 +136,11 @@ require_once BASE . "/lib/format.php";
     $query
   );
   $exact_matches = array();
-  while ($row = $result -> fetch_assoc())
+  while ($row = $result -> fetch_assoc()) {
+    foreach ($float_columns as $float_column)
+      $row[$float_column] = floatval($row[$float_column]);
     $exact_matches[] = $row;
+  }
 
   $sorts = array(
     "arch" => array(
@@ -224,8 +232,11 @@ require_once BASE . "/lib/format.php";
     " LIMIT " . (($page-1)*100) . ", 100"
   );
   $fuzzy_matches = array();
-  while ($row = $result -> fetch_assoc())
+  while ($row = $result -> fetch_assoc()) {
+    foreach ($float_columns as $float_column)
+      $row[$float_column] = floatval($row[$float_column]);
     $fuzzy_matches[] = $row;
+  }
 
   function print_results($results) {
     $oddity="odd";
-- 
cgit v1.2.3-70-g09d2