From fe9f7b356561a98eaa82a71afd0da2d9cc62b7a2 Mon Sep 17 00:00:00 2001 From: github username Date: Fri, 12 Jul 2019 12:56:40 -0400 Subject: [PATCH 1/2] final final --- lib/app/models/cli.rb | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/app/models/cli.rb b/lib/app/models/cli.rb index 4c5e7c7..e12afc8 100644 --- a/lib/app/models/cli.rb +++ b/lib/app/models/cli.rb @@ -20,8 +20,6 @@ def new_user puts "Welcome to Make Res, #{new_user.name}" @user = new_user - puts `clear` - choices end @@ -49,16 +47,17 @@ def view_all_reservations menu.choice "yes", -> { select_restaurant } menu.choice "no", -> { choices } end - end - - @prompt.select("Here are your reservations") do |menu| - Reservation.all.map do |reservation| - # @reservation = reservation - if reservation.user_id == @user.id - menu.choice "#{reservation.restaurant.name} - #{reservation.time}", -> { view_reservation(reservation) } + else + + @prompt.select("Here are your reservations") do |menu| + Reservation.all.map do |reservation| + # @reservation = reservation + if reservation.user_id == @user.id + menu.choice "#{reservation.restaurant.name} - #{reservation.time}", -> { view_reservation(reservation) } + end end + menu.choice "back", -> { choices } end - menu.choice "back", -> { choices } end end @@ -108,19 +107,25 @@ def reserve_or_review(restaurant_name) @prompt.select("Would you like to reserve or leave a review for this restaurant?") do |menu| menu.choice "Make a reservation", -> { make_reservation } menu.choice "Leave a review", -> { write_review } + menu.choice "Back", -> { choices } end end #MAKE RESERVATION def make_reservation + time = Time.new #ask for name #ask for date (09-12-19 Format) #ask for time # puts "Please enter your name: " # user_name = gets.chomp # new_user = User.find_by(name: user_name) + #binding.pry puts "You are making a reservation at #{@restaurant.name}:" + puts "This restaurant has had #{@restaurant.users.length} visitor(s) this month." + puts "#######################################" puts "For which date? " + puts time.strftime("today is %A %B %d") res_date = gets.chomp puts "at what time?" res_time = gets.chomp From 209c518c4cb6dffb30c3cc868e50cf1d36832d0e Mon Sep 17 00:00:00 2001 From: github username Date: Fri, 12 Jul 2019 12:59:23 -0400 Subject: [PATCH 2/2] final final --- lib/app/models/cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app/models/cli.rb b/lib/app/models/cli.rb index e12afc8..19ca02a 100644 --- a/lib/app/models/cli.rb +++ b/lib/app/models/cli.rb @@ -125,7 +125,7 @@ def make_reservation puts "This restaurant has had #{@restaurant.users.length} visitor(s) this month." puts "#######################################" puts "For which date? " - puts time.strftime("today is %A %B %d") + puts time.strftime("today is %A %B %d") res_date = gets.chomp puts "at what time?" res_time = gets.chomp