Skip to content

Commit

Permalink
Don't overwrite times-solved when editing problems
Browse files Browse the repository at this point in the history
  • Loading branch information
amalloy committed Sep 17, 2011
1 parent 7abcce8 commit 07c68b4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/foreclojure/problems.clj
Original file line number Diff line number Diff line change
Expand Up @@ -468,9 +468,10 @@ Return a map, {:message, :error, :url, :num-tests-passed}."
{:$inc {:seq 1}})))
edit-url (str "https://4clojure.com/problem/"
id)
approved (true? (:approved (fetch-one :problems
:where {:_id id}
:only [:approved])))]
existing-problem (fetch-one :problems
:where {:_id id}
:only [:approved :times-solved])
approved (true? (:approved existing-problem))]

(when (empty? author) ; newly submitted, not a moderator tweak
(try
Expand All @@ -490,7 +491,7 @@ Return a map, {:message, :error, :url, :num-tests-passed}."
{:_id id
:title title
:difficulty difficulty
:times-solved 0
:times-solved (or (:times-solved existing-problem) 0)
:description description
:tags (re-seq #"\S+" tags)
:restricted (re-seq #"\S+" restricted)
Expand Down

0 comments on commit 07c68b4

Please sign in to comment.