Daniel Sheffield 9 сар өмнө
parent
commit
d6689b067d
1 өөрчлөгдсөн 7 нэмэгдсэн , 1 устгасан
  1. 7 1
      sqlpage/tags.sql

+ 7 - 1
sqlpage/tags.sql

@@ -36,6 +36,8 @@ JOIN sqlpage_options og ON og.type = 'group' AND g.name = og.name
 JOIN sqlpage_options ot ON ot.type = 'tag' AND tg.name = ot.name
 WHERE 
   COALESCE(op.selected, oc.selected, og.selected, TRUE)
+AND
+  COALESCE(ot.selected, TRUE)
 AND
   op.session = sqlpage.cookie('session')
 AND
@@ -79,7 +81,11 @@ AND
   ot.session = sqlpage.cookie('session')
 AND
   ((ts AT TIME ZONE 'UTC') AT TIME ZONE 'Pacific/Auckland')::date
-  BETWEEN $start::date AND $end::date
+  BETWEEN (
+    SELECT name FROM sqlpage_options WHERE type = 'start'
+  )::date AND (
+    SELECT name FROM sqlpage_options WHERE type = 'end'
+  )::date
 );
 SELECT * FROM sqlpage_tags;