LP#1549505: fix SQL syntax error in QP
authorGalen Charlton <gmc@esilibrary.com>
Thu, 4 Feb 2016 20:26:38 +0000 (15:26 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Wed, 24 Feb 2016 22:39:41 +0000 (17:39 -0500)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Driver/Pg/QueryParser.pm

index 6d09728..b9fae94 100644 (file)
@@ -851,7 +851,7 @@ sub toSQL {
         pop_with AS (
             SELECT  record,
                     ARRAY_AGG(badge) AS badges,
-                    SUM(s.score::NUMERIC*b.wieght::NUMERIC)/SUM(b.weight::NUMERIC) AS total_score
+                    SUM(s.score::NUMERIC*b.weight::NUMERIC)/SUM(b.weight::NUMERIC) AS total_score
               FROM  rating.record_badge_score s
                     JOIN rating.badge b ON (
                         b.id = s.badge
@@ -911,7 +911,7 @@ SELECT  $key AS id,
         $agg_records,
         $rel AS rel,
         $rank AS rank, 
-        FIRST(pubdate_t.value) AS tie_break
+        FIRST(pubdate_t.value) AS tie_break,
         STRING_AGG(ARRAY_TO_STRING(pop_with.badges,','),',') AS badges,
         AVG(COALESCE(pop_with.total_score::NUMERIC,0.0))::NUMERIC(2,1) AS popularity
   FROM  metabib.metarecord_source_map m