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

@ -4,9 +4,12 @@ theme: light
# Options: daily, yesterday, weekly or all # Options: daily, yesterday, weekly or all
edition: weekly edition: weekly
feeds: feeds:
- https://programadorwebvalencia.com/feed/index.xml
- http://planet.es.python.org/rss.xml
- https://diarioestoico.com/feed/ - https://diarioestoico.com/feed/
- https://markosaric.com/feed/ - https://republicaweb.es/feed/podcast
- https://jvns.ca/atom.xml
old:
- https://static.fsf.org/fsforg/rss/news.xml - https://static.fsf.org/fsforg/rss/news.xml
- https://hakibenita.com/feeds/all.atom.xml - https://hakibenita.com/feeds/all.atom.xml
- https://www.blogger.com/feeds/5402814408460261521/posts/default - https://www.blogger.com/feeds/5402814408460261521/posts/default

View File

@ -31,6 +31,7 @@
<orderEntry type="library" name="Leiningen: hiccup:1.0.5" level="project" /> <orderEntry type="library" name="Leiningen: hiccup:1.0.5" level="project" />
<orderEntry type="library" name="Leiningen: joda-time:2.10" level="project" /> <orderEntry type="library" name="Leiningen: joda-time:2.10" level="project" />
<orderEntry type="library" name="Leiningen: json-html:0.4.4" level="project" /> <orderEntry type="library" name="Leiningen: json-html:0.4.4" level="project" />
<orderEntry type="library" name="Leiningen: log4j:1.2.12" level="project" />
<orderEntry type="library" name="Leiningen: nrepl:0.6.0" level="project" /> <orderEntry type="library" name="Leiningen: nrepl:0.6.0" level="project" />
<orderEntry type="library" name="Leiningen: org.apache.httpcomponents/httpasyncclient:4.1.4" level="project" /> <orderEntry type="library" name="Leiningen: org.apache.httpcomponents/httpasyncclient:4.1.4" level="project" />
<orderEntry type="library" name="Leiningen: org.apache.httpcomponents/httpclient-cache:4.5.10" level="project" /> <orderEntry type="library" name="Leiningen: org.apache.httpcomponents/httpclient-cache:4.5.10" level="project" />
@ -44,7 +45,8 @@
<orderEntry type="library" name="Leiningen: org.clojure/data.xml:0.2.0-alpha6" level="project" /> <orderEntry type="library" name="Leiningen: org.clojure/data.xml:0.2.0-alpha6" level="project" />
<orderEntry type="library" name="Leiningen: org.clojure/spec.alpha:0.2.194" level="project" /> <orderEntry type="library" name="Leiningen: org.clojure/spec.alpha:0.2.194" level="project" />
<orderEntry type="library" name="Leiningen: org.jdom/jdom2:2.0.6" level="project" /> <orderEntry type="library" name="Leiningen: org.jdom/jdom2:2.0.6" level="project" />
<orderEntry type="library" name="Leiningen: org.slf4j/slf4j-api:1.7.16" level="project" /> <orderEntry type="library" name="Leiningen: org.slf4j/slf4j-api:1.7.25" level="project" />
<orderEntry type="library" name="Leiningen: org.slf4j/slf4j-log4j12:1.7.25" level="project" />
<orderEntry type="library" name="Leiningen: org.yaml/snakeyaml:1.5" level="project" /> <orderEntry type="library" name="Leiningen: org.yaml/snakeyaml:1.5" level="project" />
<orderEntry type="library" name="Leiningen: potemkin:0.4.5" level="project" /> <orderEntry type="library" name="Leiningen: potemkin:0.4.5" level="project" />
<orderEntry type="library" name="Leiningen: remus:0.2.1" level="project" /> <orderEntry type="library" name="Leiningen: remus:0.2.1" level="project" />

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 (defn filter-edition
[articles] [articles]
(let [daily (- (c/to-long (t/now)) 86400) (let [daily (c/to-long (t/minus (t/now) (t/days 1)))
weekly (- (c/to-long (t/now)) 604800)] weekly (c/to-long (t/minus (t/now) (t/weeks 1)))]
(case (:edition config) (case (:edition config)
"daily" (filter (fn [article] (> (:published-date article) daily)) articles) "daily" (filter (fn [article] (>= (:published-date article) daily)) articles)
"weekly" (filter (fn [article] (> (:published-date article) weekly)) articles) "weekly" (filter (fn [article] (>= (:published-date article) weekly)) articles)
:else articles))) :else articles)))