-
-
-
-
-
-
- Your option is not on the list?
- <%= link_to 'Add it now!', new_bet_bet_option_path(@bet) %>
-
-
-
-
+<% if @bet.resolved? %>
+<% else %>
+ <%= render 'display_unresolved_bets', bet: @bet, user_bet: @user_bet %>
+<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index ba1a289..7829a04 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -8,6 +8,9 @@
get '/signup', to: 'users#new', as: :new_user_path
+ get 'bets/:id/resolve', to: 'bets#resolve', as: :resolve_bet
+ post 'bets/:id/calculate_debts', to: 'bets#calculate_debts',
+ as: :calculate_debts
resources :bets do
resources :user_bets, only: :create
resources :bet_options, shallow: true
diff --git a/db/migrate/20170410224347_add_boolean_column_resolved_to_bets.rb b/db/migrate/20170410224347_add_boolean_column_resolved_to_bets.rb
new file mode 100644
index 0000000..81d92f0
--- /dev/null
+++ b/db/migrate/20170410224347_add_boolean_column_resolved_to_bets.rb
@@ -0,0 +1,5 @@
+class AddBooleanColumnResolvedToBets < ActiveRecord::Migration[5.0]
+ def change
+ add_column :bets, :resolved, :boolean, default: false
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e323042..7a23527 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20170405174138) do
+ActiveRecord::Schema.define(version: 20170410224347) do
create_table "bet_options", force: :cascade do |t|
t.text "option_text"
@@ -24,10 +24,11 @@
create_table "bets", force: :cascade do |t|
t.text "description"
t.integer "status"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
- t.integer "creator_id", null: false
- t.datetime "expires_at", null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.integer "creator_id", null: false
+ t.datetime "expires_at", null: false
+ t.boolean "resolved", default: false
end
create_table "debts", force: :cascade do |t|