Fork me on GitHub
#beginners
<
2022-10-05
>
rolt11:10:07

how dynamic ? is multi-spec what you're looking for ?

popeye11:10:14

@U02F0C62TC1 Thanks for the response, dynamic is sometime response fields only be two, some time it would be six, some time response fields are :a :b :c and some time they are :d :e

popeye11:10:16

response depends on different icons, so each response field to be validated,

Kevin Izevbigie13:10:24

Is there a proven puppeteer equivalent for clojure?

Kevin Izevbigie13:10:53

mind blown. Thank Lispy

lispyclouds13:10:07

😄 also can throw https://github.com/babashka/nbb/blob/main/examples/playwright/example.cljs into it too for good measure. im never sure which one's the better 😅

lread13:10:42

@U03KA8JTY1G I'm a maintainer on etaoin, if you go that route and have questions feel free to drop by #etaoin. I've learned that some folks prefer playwright/puppeteer because it offers more control over such things as waiting for elements.

🙌 1
Kevin Izevbigie13:10:51

Nice man, I will give that a go too

👍 1
Abhi Saxena15:10:18

Hi Clojurians - I have a function where I want to see if the Database record already exists, If yes, I have to update it otherwise insert a new record, it looks something like this, I also have to make sure that I return the record updated/ created. (defn handle-post-client-targets [context a-val b-val arguments] (if-let [client-target (first-item (get-client-target context a-val b-val))] (let [ updated-record (update-client-supplied-study-target context a-val b-val arguments)] (let [ updated-record (insert-client-supplied-study-target context a-val b-val arguments)] updated-record)))) Is there a way to achieve this by making sure I return the object updated.

walterl15:10:50

(defn handle-post-client-targets [context a-val b-val arguments]
  (if (first-item (get-client-target context a-val b-val))
    (update-client-supplied-study-target context a-val b-val arguments)
    (insert-client-supplied-study-target context a-val b-val arguments)))
Unless I'm missing something.

walterl15:10:15

(Removed the let-binding because it was unused.)

dpsutton15:10:16

you should see if your database has a notion of upsert. You have a race 1. check if record exists (it does not) 2. record is inserted from another thread/request 3. try to insert new record (it blows up maybe, or you violate a logical constraint and now have two records)

☝️ 1
👍 1