Fix date filter

This commit is contained in:
Andros Fenollosa
2021-07-18 11:53:06 +02:00
parent 0c1a2dc585
commit ab9fe22ff6
4 changed files with 12 additions and 19 deletions

View File

@@ -1,12 +0,0 @@
log4j.rootLogger=DEBUG, R
#Output to the file, and a new file is generated when the file size reaches the specified size
log4j.appender.R=org.apache.log4j.RollingFileAppender
#Output to the console
#log4j.appender.stdout=org.apache.log4j.ConsoleAppender
#log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.R.File=./log/logger1.log
log4j.appender.R.MaxBackupIndex=20
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=[%d][%p][%c] %m%n

View File

@@ -17,11 +17,11 @@
(defn filter-edition
[articles]
(let [daily (- (c/to-long (t/now)) 86400)
weekly (- (c/to-long (t/now)) 604800)]
(let [daily (c/to-long (t/minus (t/now) (t/days 1)))
weekly (c/to-long (t/minus (t/now) (t/weeks 1)))]
(case (:edition config)
"daily" (filter (fn [article] (> (:published-date article) daily)) articles)
"weekly" (filter (fn [article] (> (:published-date article) weekly)) articles)
"daily" (filter (fn [article] (>= (:published-date article) daily)) articles)
"weekly" (filter (fn [article] (>= (:published-date article) weekly)) articles)
:else articles)))