Open yareeh opened 7 years ago
Here is the whole expiration.clj file:
(ns saldopalvelu.expiration
(:require [dotenv.core :as dotenv]))
(def cart-expiration-time (* 1000 60 (:cart-expiration-time-minutes dotenv/env)))
(def locked-order-expiration-time (* 80 60 1000))
(defn calculate-order-expiration-time
[order cart-timeout locked-ms]
(let [creation-time (-> :timestamp order .getTime)
now-time (-> :now order .getTime)
expiration-time (+ creation-time cart-timeout locked-ms)]
{:expiration-time expiration-time :db-time now-time}))
(defn is-expired-order? [order cart-timeout locked-ms]
(let [times (calculate-order-expiration-time order cart-timeout locked-ms)]
(>= (:db-time times) (:expiration-time times))))
(defn locked-time-ms [shopping-orders locked-orders]
(let [zipped (apply vector (zipmap (map #(-> :timestamp % .getTime) shopping-orders)
(map #(-> :timestamp % .getTime) locked-orders)))]
(reduce (fn [memo shopping-to-locked]
(+ memo (- (first shopping-to-locked) (second shopping-to-locked)))) 0 zipped)))
This was fixed when I upgraded to
IntelliJ IDEA 2016.3.1 Build #IU-163.9166.20, built on December 6, 2016 Licensed to Reaktor Innovations / Jari Mäkelä Subscription is active until August 31, 2017 JRE: 1.8.0_112-release-408-b2 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
After updating both Cursive and IntelliJ to the latest versions I get this error:
The expiration.clj does not have any syntax error and
lein run
from the command line works just as it did before the IDE and plugin update and is able to compile and run the project.Cursive version: 1.4.0-2016.3
IntelliJ version: IntelliJ IDEA 2016.3 Build #IU-163.7743.44, built on November 17, 2016 JRE: 1.8.0_112-release-408-b2 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o