summaryrefslogtreecommitdiff
path: root/src/logikorr.clj
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-11-29 01:03:29 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-11-29 01:03:29 +0100
commit23ef791d20fe50bf3ea4d5a27f36b170a9da9a3b (patch)
tree3cc92ead8e4d0610b8b56c954b7f0c06e749f57c /src/logikorr.clj
parent4dcae780057df32689e54aee80c87e3c6cb78199 (diff)
Support the creation of new revisions.
Diffstat (limited to 'src/logikorr.clj')
-rw-r--r--src/logikorr.clj12
1 files changed, 10 insertions, 2 deletions
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)))