<commit_before>(ns salava.metabadge.db
  (:require [yesql.core :refer [defqueries]]
            [salava.core.util :as u]))

(defqueries "sql/metabadge/queries.sql")

(defn badge-id-by-assertion
  "in case of multiple hits return the most recent"
  [ctx assertion_url]
  (some-> (select-user-badge-id-by-assertion-url {:assertion_url assertion_url} (u/get-db ctx)) #_(into {:result-set-fn first :row-fn :id} (u/get-db ctx)) first :id))
<commit_msg>refactor<commit_after>(ns salava.metabadge.db
  (:require [yesql.core :refer [defqueries]]
            [salava.core.util :as u]))

(defqueries "sql/metabadge/queries.sql")

(defn badge-id-by-assertion
  "in case of multiple hits return the most recent"
  [ctx assertion_url]
  (some-> (select-user-badge-id-by-assertion-url {:assertion_url assertion_url} (u/get-db ctx)) first :id))

{'fraction_non_alphanumeric': 0.15542168674698795, 'fraction_numerical': 0.0, 'mean_word_length': 4.161490683229814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '498625', 'n_tokens_mistral': 320, 'n_tokens_neox': 310, 'n_words': 71}