Skip to content
Browse files

Merge branch 'hotfix/1.2.1'

  • Loading branch information...
2 parents ce29962 + a601de1 commit c079fcae76711c582117ec7303a6a88d6496935c @amalloy amalloy committed Sep 11, 2011
Showing with 23 additions and 6 deletions.
  1. +23 −6 src/foreclojure/users.clj
View
29 src/foreclojure/users.clj
@@ -88,12 +88,29 @@
(filter ids (get-solved username)))))
(def-page user-profile [username]
- [:h2 "User: " username]
- [:hr]
- [:table
- (for [difficulty ["Elementary" "Easy" "Medium" "Hard"]]
- [:tr [:td.count-label difficulty] [:td.count-value [:div.progress-bar-bg [:div.progress-bar {:style (str "width: " (* 100 (/ (count (get-solved username difficulty)) (count (get-problems difficulty)))) "%")}]]]])
- [:tr [:td.count-total "TOTAL:" ] [:td.count-value (count (get-solved username)) "/" (count (get-problems))]]])
+ (let [page-title (str "User: " username)]
+ {:title title
+ :content
+ (list
+ [:h2 "User: " username]
+ [:hr]
+ [:table
+ (for [difficulty ["Elementary" "Easy" "Medium" "Hard"]]
+ (let [solved (count (get-solved username difficulty))
+ total (count (get-problems difficulty))]
+ [:tr
+ [:td.count-label difficulty]
+ [:td.count-value
+ [:div.progress-bar-bg
+ [:div.progress-bar
+ {:style (str "width: "
+ (int (* 100 (/ solved total)))
+ "%")}]]]]))
+ [:tr
+ [:td.count-total "TOTAL:" ]
+ [:td.count-value
+ (count (get-solved username)) "/"
+ (count (get-problems))]]])}))
(defn set-disable-codebox [disable-flag]
(with-user [{:keys [_id]}]

0 comments on commit c079fca

Please sign in to comment.
Something went wrong with that request. Please try again.