@@ -34,7 +34,7 @@ FROM code c
LEFT JOIN code_detail cd
ON c.hash = cd.hash
WHERE (
- cd.expiry IS NULL OR COALESCE($expired, 'false') = 'true' OR date(cd.expiry) > date(datetime(CURRENT_TIMESTAMP, 'localtime'))
+ cd.expiry IS NULL OR COALESCE($expired, 'false') = 'true' OR date(cd.expiry) >= date(datetime(CURRENT_TIMESTAMP, 'localtime'))
) AND (
cd.used IS NULL OR COALESCE($used||'', 'false') = 'true' OR COALESCE(cd.used||'','') = 'false'