Skip to content

Commit

Permalink
Issue macourtney#15: The open offers table now displays has / wants a…
Browse files Browse the repository at this point in the history
…nd wants / has.
  • Loading branch information
macourtney committed Jul 15, 2011
1 parent 8f1ed7c commit 1b93113
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
7 changes: 0 additions & 7 deletions src/darkexchange/controller/main/home/open_offer_panel.clj
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@
(action-utils/attach-listener main-frame "#new-open-offer-button"
(fn [e] (new-offer/show main-frame (create-add-offer-call-back main-frame)))))

(comment
(defn delete-selected-offer [main-frame]
(let [open-offer-table (find-open-offer-table main-frame)
selected-row-index (.getSelectedRow open-offer-table)]
(offer-model/delete-offer (:id (seesaw-table/value-at open-offer-table selected-row-index)))))
)

(defn selected-offer-id [main-frame]
(let [open-offer-table (find-open-offer-table main-frame)]
(:id (seesaw-table/value-at open-offer-table (.getSelectedRow open-offer-table)))))
Expand Down
24 changes: 13 additions & 11 deletions src/darkexchange/model/offer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,6 @@
(defn wants-payment-type-str [offer]
(payment-type-str offer :wants_payment_type))

(defn convert-to-table-offer [offer]
{ :id (:id offer)
:i-have-amount (has-amount-str offer)
:i-want-to-send-by (has-payment-type-str offer)
:i-want-amount (wants-amount-str offer)
:i-want-to-receive-by (wants-payment-type-str offer) })

(defn table-open-offers []
(map convert-to-table-offer (open-offers)))

(defn delete-offer [offer-id]
(destroy-record { :id offer-id }))

Expand All @@ -139,4 +129,16 @@
(/ (:has_amount offer) (:wants_amount offer)))

(defn calculate-wants-div-has [offer]
(/ (:wants_amount offer) (:has_amount offer)))
(/ (:wants_amount offer) (:has_amount offer)))

(defn convert-to-table-offer [offer]
{ :id (:id offer)
:i-have-amount (has-amount-str offer)
:i-want-to-send-by (has-payment-type-str offer)
:i-want-amount (wants-amount-str offer)
:i-want-to-receive-by (wants-payment-type-str offer)
:has-div-wants (calculate-has-div-wants offer)
:wants-div-has (calculate-wants-div-has offer) })

(defn table-open-offers []
(map convert-to-table-offer (open-offers)))
4 changes: 3 additions & 1 deletion src/darkexchange/view/main/home/open_offer_panel.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
{ :key :i-have-amount :text (terms/i-have-amount) }
{ :key :i-want-to-send-by :text (terms/i-want-to-send-by) }
{ :key :i-want-amount :text (terms/i-want-amount) }
{ :key :i-want-to-receive-by :text (terms/i-want-to-receive-by) } ])
{ :key :i-want-to-receive-by :text (terms/i-want-to-receive-by) }
{ :key :has-div-wants :text (terms/has-div-wants) }
{ :key :wants-div-has :text (terms/wants-div-has) } ])

(defn create-table-header-text []
(terms/open-offers))
Expand Down

0 comments on commit 1b93113

Please sign in to comment.