summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-11-29 01:15:29 +0100
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2009-11-29 01:15:29 +0100
commitc12fcdddece33fd3a849299305dcd11bbe44deba (patch)
treee7a144e9d2e5c380dc3c0b90ca9ab3750ff8fea8
parent23ef791d20fe50bf3ea4d5a27f36b170a9da9a3b (diff)
Use transactions more pervasively.
-rw-r--r--src/logikorr.clj17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/logikorr.clj b/src/logikorr.clj
index 5a646e6..cf35929 100644
--- a/src/logikorr.clj
+++ b/src/logikorr.clj
@@ -120,14 +120,15 @@
:last-name (:last-name student)})))
(defn update-student-score [id score-number new-score-value]
- (let [student (find-student-by-id id)
- score (:score student)
- num (Integer. score-number)]
- (ds-update (assoc student
- :score (concat (take num score)
- [(Float. new-score-value)]
- (drop (+ 1 num) score)))))
- "\"OK\"")
+ (with-ds-transaction
+ (let [student (find-student-by-id id)
+ score (:score student)
+ num (Integer. score-number)]
+ (ds-update (assoc student
+ :score (concat (take num score)
+ [(Float. new-score-value)]
+ (drop (+ 1 num) score)))))
+ "\"OK\""))
(defn make-new-revision []
(with-ds-transaction