Fork me on GitHub
#xtdb
<
2023-10-18
>
Vincent01:10:13

Hello. Can I compute a new value on xt/q ? I want to return with the tuple a new value score that isn't stored in the DB, but is determined based on timestamp, upvotes, and current time...

Vincent03:10:07

I was able to figure it out,

(sort-by #(/ (get % :item/upvotes) (Math/pow (+ (/ (- (System/currentTimeMillis) (get % :item/minted-at)) 3600) 2) 1.5)) >) ;;score
turns out the System/currentTimeMillis was the issue in Electricland xD 😃

clojure-spin 1
🎉 1
refset09:10:59

nice, thanks for sharing your solution 🙂

akis20:10:41

Hi! I really like the changes proposed in 2.0 - are there any examples out there, other than the ones in the docs?

akis20:10:37

thanks, datalog_test has already been a great reference to figure out how :table works 😄

🙂 1