From 18cc3e730cf414b69ff45930e4ac8090ea308a0e Mon Sep 17 00:00:00 2001 From: Felisp Date: Tue, 24 Sep 2024 00:53:47 +0200 Subject: [PATCH] Refactored that horrible abomination of a code I don't do drugs but I must have or something, otherwise that is just unexplainable, I'm sorry if you had to see that, I really am --- src/rss_thread_watch/feed_generator.clj | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index ed9cbe5..9b0bf83 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -145,18 +145,12 @@ ;; qrs (prms "q") self-uri (str (s/replace-first scheme ":" "") "://" server-name uri "?" query) - ;; queries (if (vector? qrs) qrs [qrs]) ; to always return vector - real-chod (if-let [ch (or (and (vector? chod) - (first chod)) - chod)] - (try ;If we can't parse number from chod, use default 94 - (if (or (vector? chod) - ;; TODO: Do we seriously parse this twice? - (<= (Integer/parseInt chod) 60)) ; Never accept chod lower than 60 TODO: don't hardcode this - 60 (Integer/parseInt chod)) - (catch Exception e - 94))) board-config (get-in @conf/GLOBAL-CONFIG [:boards-enabled board]) + real-chod (try (max (Integer/parseInt (or (and (vector? chod) + (first chod)) + chod)) 60) ;HARDCODED CHoD + (catch Exception _ + (get board-config :default-chod))) cache @watcher/chod-threads-cache] (println "\n\nRCVD: " rqst) ;; (println rqst)