<commit_before>(ns checkin-halake.models.users
  (:require [monger.core :as mg]
            [monger.collection :as mc]
            [environ.core :refer [env]])
  (:use [crypto.password.bcrypt :only [encrypt check]]
        checkin-halake.models.core))

(defn- fix-user [doc]
  (dissoc doc :password))

(defn register-user [email password name phone]
  (let [password (encrypt password)
        user {:_id email, :name name,
              :phone phone, :password password,
              :createdAt (java.util.Date.)}]
    (-> (mc/insert-and-return db "users" user)
        fix-user)))
<commit_msg>Modify user model to construct user tickets explicitly at creation time<commit_after>(ns checkin-halake.models.users
  (:require [monger.core :as mg]
            [monger.collection :as mc]
            [environ.core :refer [env]]
            [checkin-halake.models.ticket :as ticket])
  (:use [crypto.password.bcrypt :only [encrypt check]]
        checkin-halake.models.core))

(defn- fix-user [doc]
  (dissoc doc :password))

(def initial-tickets
  (zipmap (keys ticket/ticket-types)
          (repeat 0)))

(defn register-user [email password name phone]
  (let [password (encrypt password)
        user {:_id email, :name name,
              :phone phone, :password password,
              :createdAt (java.util.Date.)
              :tickets initial-tickets}]
    (-> (mc/insert-and-return db "users" user)
        fix-user)))

{'fraction_non_alphanumeric': 0.13403508771929826, 'fraction_numerical': 0.0007017543859649122, 'mean_word_length': 2.610126582278481, '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': '4023219', 'n_tokens_mistral': 453, 'n_tokens_neox': 448, 'n_words': 122}