 	[somnium.congomongo]
         [hiccup form-helpers])
   (:require [sandbar.stateful-session :as session]
-            [clojure.string :as s]))
+            [clojure.string :as s]
+            [clj-github.gists :as gist]))
 
 (defn get-solved [user]
   (set

          :only [:_id :title :tags :times-solved]
          :sort {:id 1})))

(defn mark-completed [id]
  (if-let [user (session/session-get :user)]
    (do
      (when (not-any? #{id} (get-solved user))
        (update! :users {:user user} {:$push {:solved id}})
        (update! :problems {:_id id} {:$inc {:times-solved 1}}))
      (flash-msg "Congratulations, you've solved the problem!" "/problems")) 
    (flash-msg "You've solved the problem! If you log in we can track your progress." "/problems")))

(defn get-tester [restricted]
  (into secure-tester (map symbol restricted)))

      (try
	(loop [[test & more] tests]
	  (if-not test
	    (mark-completed id code)
	    (let [testcase (s/replace test "__" (str code))]
	      (if (sb sb-tester (read-string testcase))
		(recur more)
