summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-12-02 12:25:34 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-12-02 12:25:34 +0100
commit6aadd1b6f2237511e1b853327136e892ec4ef0c0 (patch)
tree2de4eb8a68b7df62cc0e0e54983e69858c49971d /src
parentb088861de838d1dbff91fe062442f37053df8b6b (diff)
make-new-revision: Improve performance.
Diffstat (limited to 'src')
-rw-r--r--src/logikorr/servlet.clj13
1 files changed, 10 insertions, 3 deletions
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]