Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: joshe/iamin
base: fc82e7f68a
...
head fork: joshe/iamin
compare: 1c63291096
  • 2 commits
  • 5 files changed
  • 0 commit comments
  • 1 contributor
View
2  Gemfile.lock
@@ -48,7 +48,7 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
- mysql2 (0.2.7)
+ mysql2 (0.2.11)
polyglot (0.3.1)
rack (1.2.3)
rack-mount (0.6.14)
View
1  app/controllers/events_controller.rb
@@ -27,6 +27,7 @@ def show
@event = Event.find(params[:id])
@event_user_count = @event.users.size
@event_cpp = @event.event_cost / @event_user_count
+ @your_share_will_be = @event.event_cost / (@event_user_count + 1)
@event_users = @event.users
@user = User.find(session[:user_id])
@user_is_in = @event_users.include?(@user)
View
5 app/views/events/show.html.haml
@@ -9,9 +9,9 @@
- else
.eventStatus.go= "This event is on."
-%p= "Cost: $#{@event.event_cost}"
+%p= "Cost: #{number_to_currency(@event.event_cost, :unit => "$")}"
- unless @event_user_count == 0
- %p= "Cost per person: $#{@event_cpp}"
+ %p= "Cost per person: #{number_to_currency(@event_cpp, :unit => "$")}"
%p= "Number of users: #{@event_user_count}"
%ul
@@ -23,6 +23,7 @@
- unless @user_is_in
= button_to "I am in", :action => "join", :id => @event.id
+ = "If you join, each person will pay a max of #{number_to_currency(@your_share_will_be, :unit => "$")}"
.spread
.twshare.left
View
13 db/migrate/20110902131831_change_event_cost_column_to_decimal.rb
@@ -0,0 +1,13 @@
+class ChangeEventCostColumnToDecimal < ActiveRecord::Migration
+ def self.up
+ change_table :events do |t|
+ t.change :event_cost, :decimal, { :precision => 8, :scale => 2 }
+ end
+ end
+
+ def self.down
+ change_table :events do |t|
+ t.change :event_cost, :float
+ end
+ end
+end
View
8 db/schema.rb
@@ -10,16 +10,16 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20110831114511) do
+ActiveRecord::Schema.define(:version => 20110902131831) do
create_table "events", :force => true do |t|
t.string "event_title"
- t.float "event_cost"
+ t.decimal "event_cost", :precision => 8, :scale => 2
t.string "event_planner"
t.datetime "created_at"
t.datetime "updated_at"
- t.integer "threshold", :default => 1
- t.integer "max", :default => 0
+ t.integer "threshold", :default => 1
+ t.integer "max", :default => 0
t.datetime "event_date"
t.datetime "event_deadline"
end

No commit comments for this range

Something went wrong with that request. Please try again.