more postgres migration
more postgres migration

--- a/displayAgency.php
+++ b/displayAgency.php
@@ -29,7 +29,7 @@
     $query = 'SELECT "CNID", "description", "value", "agencyName", "category",

     "contractStart", "supplierName"

     FROM contractnotice

-    WHERE "agencyName" = :agency

+    WHERE "agencyName" like :agency

     ORDER BY "value" DESC limit 100';

     $query = $conn->prepare($query);

     $query->bindParam(":agency", $agency);


--- a/lib/common.inc.php
+++ b/lib/common.inc.php
@@ -100,9 +100,9 @@
 

 $startYear = 2007;

 $year = filter_var($_REQUEST['year'], FILTER_SANITIZE_NUMBER_INT);

-if ($year != "")

+if ($year != "") {

     $yearQ = "YEAR(publishDate) = " . $year . " AND ";

-

+}

 $standardQ = ' "childCN" is null '; // AND YEAR(contractStart) >= 2007 AND YEAR(contractStart) <= 2010';

 $start = 0.0;

 


--- a/lib/graphs.inc.php
+++ b/lib/graphs.inc.php
@@ -220,7 +220,7 @@
     global $conn;
     $agency = "AusAid";
     $topX = 15;
-    $query = 'SELECT SUM(value) as val, "supplierName" FROM contractnotice WHERE (extract ("YEAR" from "contractStart") >= :startYear) AND "childCN" is null AND "agencyName" = :agency
+    $query = 'SELECT SUM(value) as val, "supplierName" FROM contractnotice WHERE extract ("YEAR" from "contractStart") >= :startYear AND "childCN" is null AND "agencyName" like :agency
 GROUP BY lower(supplierName) ORDER BY val DESC limit $topX';
     $query = $conn->prepare($query);
     $query->bindParam(":startYear", $startYear);
@@ -235,7 +235,7 @@
     }
 
 
-    $query = 'SELECT sum(a.val) as value, count(1) as count from (SELECT SUM(value) as val, "supplierName" FROM contractnotice WHERE (extract ("YEAR" from "contractStart") >= :startYear) AND "childCN" is null and "agencyName" = :agency
+    $query = 'SELECT sum(a.val) as value, count(1) as count from (SELECT SUM(value) as val, "supplierName" FROM contractnotice WHERE (extract ("YEAR" from "contractStart") >= :startYear) AND "childCN" is null and "agencyName" like :agency
 GROUP BY lower("supplierName") ORDER BY val DESC LIMIT 18446744073709551610 OFFSET $topX) as a';
     $query = $conn->prepare($query);
     $query->bindParam(":startYear", $startYear);