From 6aadd1b6f2237511e1b853327136e892ec4ef0c0 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Wed, 2 Dec 2009 12:25:34 +0100 Subject: make-new-revision: Improve performance. --- src/logikorr/servlet.clj | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/logikorr/servlet.clj b/src/logikorr/servlet.clj index 7160f1f..10ef5d5 100644 --- a/src/logikorr/servlet.clj +++ b/src/logikorr/servlet.clj @@ -144,9 +144,16 @@ (let [current (current-revision) students (find-students) new (ds/create {:kind "revision" - :number (inc (:number current))})] - (doseq [student students] - (ds/create (assoc (dissoc student :key) :kind "student") (:key new))) + :number (inc (:number current))}) + new-key (:key new) + datastore (DatastoreServiceFactory/getDatastoreService)] + (.put datastore + (map (fn [student] + (doto (Entity. "student" #^Key new-key) + (.setProperty "first-name" (:first-name student)) + (.setProperty "last-name" (:last-name student)) + (.setProperty "score" (:score student)))) + students)) (str (:number new))))) (defn call-with-authentication [thunk] -- cgit v1.2.3