From 23ef791d20fe50bf3ea4d5a27f36b170a9da9a3b Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 29 Nov 2009 01:03:29 +0100 Subject: Support the creation of new revisions. --- src/logikorr.clj | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/logikorr.clj') diff --git a/src/logikorr.clj b/src/logikorr.clj index a8f08e7..5a646e6 100644 --- a/src/logikorr.clj +++ b/src/logikorr.clj @@ -129,7 +129,15 @@ (drop (+ 1 num) score))))) "\"OK\"") -(defn create-new-revision []) +(defn make-new-revision [] + (with-ds-transaction + (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))) + (str (:number new))))) (defroutes logikorr (GET "/" index) @@ -137,7 +145,7 @@ (GET "/logikorr-completion-data.js" (compute-completion-data-js)) (GET "/find-student" (find-student-json (:name params))) (GET "/update-student-score" (update-student-score (:id params) (:score-number params) (:score params))) - (GET "/create-new-revision" (create-new-revision)) + (GET "/make-new-revision" (make-new-revision)) (GET "/*" (or (serve-file *static-directory* (params :*)) :next)) (ANY "/*" (page-not-found))) -- cgit v1.2.3