From 98ab38ff54bd58ce6f27c8e5b7708db4c959ebcc Mon Sep 17 00:00:00 2001 From: denise Date: Tue, 28 Aug 2012 11:22:41 -0400 Subject: [PATCH] CC-4295: Smart Block: Please deal with the float value when criteria likes 'length is' -fixed --- airtime_mvc/application/models/Block.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/airtime_mvc/application/models/Block.php b/airtime_mvc/application/models/Block.php index 005fc18f8..13b7396f9 100644 --- a/airtime_mvc/application/models/Block.php +++ b/airtime_mvc/application/models/Block.php @@ -1187,6 +1187,16 @@ EOT; if (isset($criteria['extra'])) { $spCriteriaExtra = $criteria['extra']*1000; } + /* + * If user is searching for an exact match of length we need to + * search as if it starts with the specified length because the + * user only sees the rounded version (i.e. 4:02.7 is 4:02.761625 + * in the database) + */ + } else if ($spCriteria == 'length' && $spCriteriaModifier == "is") { + $spCriteriaModifier = "starts with"; + $spCriteria = $spCriteria.'::text'; + $spCriteriaValue = $criteria['value']; } else { /* Propel does not escape special characters properly when using LIKE/ILIKE * We have to add extra slashes in these cases @@ -1214,6 +1224,7 @@ EOT; } $spCriteriaModifier = self::$modifier2CriteriaMap[$spCriteriaModifier]; + try { if ($i > 0) { $qry->addOr($spCriteria, $spCriteriaValue, $spCriteriaModifier);