diff --git a/src/TODO.md b/src/TODO.md index a9f2507..ddb4c8a 100644 --- a/src/TODO.md +++ b/src/TODO.md @@ -1,12 +1,13 @@ # TODO - Auction searching at index 40% - - Bidding 90% TODO: refactor - - Recent posts (profile & index page) + - Bidding 99% TODO: add money check ---------------- - Auction expiry (unable to bid after x time) - User reviews - Yardoc 50% ---------------- + - Remove bids + - Remove posts ## Refactor - Funds transfer logic for auctions? diff --git a/src/lib/db_models.rb b/src/lib/db_models.rb index 25f3c89..26abc07 100644 --- a/src/lib/db_models.rb +++ b/src/lib/db_models.rb @@ -290,7 +290,7 @@ class Auction < EntityModel @user_id = data["user_id"].to_i @title = data["title"] @description = data["description"] - @init_price = data["price"].to_i + @init_price = data["price"].to_f @start_time = data["start_time"].to_i @end_time = data["end_time"].to_i end @@ -348,6 +348,10 @@ class Auction < EntityModel ah && ah.expired? end + def poster + User.find_by_id @user_id + end + def images Image.get_relation @id end @@ -394,9 +398,9 @@ class Auction < EntityModel def current_bid mbid = self.max_bid if mbid != nil then - return mbid.amount + return mbid.amount.to_f else - return @init_price + return @init_price.to_f end end diff --git a/src/views/auction/index.slim b/src/views/auction/index.slim index c098403..ee1799c 100644 --- a/src/views/auction/index.slim +++ b/src/views/auction/index.slim @@ -18,6 +18,13 @@ input type="checkbox" name="expired" label Expired? + - if Category.get_all.length > 0 + label Categories + - Category.get_all.each do |category| + .checkbox-container + input type="checkbox" name="category-#{category.id}" value="#{category.id}" + label style="color: #{category.color};" = "#{category.name}" + input type="submit" value="Search" a.button href="/auctions" = "Clear Filters" @@ -39,6 +46,8 @@ - if auction.end_time and auction.end_time - Time.now.to_i <= 0 span.red | [Expired] + h4 + | Posted by: #{auction.poster.name} h4 | #{COINS_PREFIX}#{auction.current_bid}#{COINS_SUFFIX} p diff --git a/src/views/index.slim b/src/views/index.slim index 528fb73..f55d11f 100644 --- a/src/views/index.slim +++ b/src/views/index.slim @@ -30,6 +30,8 @@ - if auction.end_time and auction.end_time - Time.now.to_i <= 0 span.red | [Expired] + h4 + | Posted by: #{auction.poster.name} h4 | #{COINS_PREFIX}#{auction.current_bid}#{COINS_SUFFIX} p diff --git a/src/views/stylesheets/style.sass b/src/views/stylesheets/style.sass index 0cec0e2..ea9ac7f 100644 --- a/src/views/stylesheets/style.sass +++ b/src/views/stylesheets/style.sass @@ -481,6 +481,7 @@ ul.list-container width: 40rem margin-right: 4rem .form-container + margin-top: 8rem form padding: 0 width: inherit