summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)))