app/models/cli.rb
#------Asks user about completion of possiblity and saves status of activity
Asks user about completion of possiblity and saves status of activity
Asks user about completion of possiblity and saves status of activity
def complete_activity
    if self.activity.status != "accepted and completed"
      puts ""
      puts Rainbow("*").blue * 70
      puts ""
      puts ""
      puts ""
      puts ""
      puts ""
      puts "Okay, now get busy!" + Rainbow(" (#{self.possibility.name})").bright
      puts ""
      puts "When you are finished, come back and press:"
      puts ""
      puts ""
      puts "1. If you have completed this activity"
      puts "2. If you got distracted and failed to complete the activity"
      puts ""
      puts ""
      self.completed_activity = gets.strip
      self.quit if self.completed_activity == "quit"
      if ["1", "2"].all? { |i| self.completed_activity != i}
        self.what_was_that?
        self.complete_activity
      end
      if self.completed_activity == "1"
        self.activity.status = "accepted and completed"
        self.activity.save
        puts ""
        self.get_rating
        puts ""
        puts Rainbow("*").blue * 70
        puts ""
        puts ""
        puts ""
        puts ""
        puts ""
        puts "Thanks for your rating!"
        puts ""
        puts ""
        self.activity.activity_stats
        puts ""
        self.suggest_new_possibility?
      elsif self.completed_activity == "2"
        self.activity.status = "accepted but not completed"
        self.activity.save
        puts ""
        puts Rainbow("*").blue * 70
        puts ""
        puts ""
        puts ""
        puts ""
        self.suggest_new_possibility?
      end
    end
  end
def complete_activity if self . activity . status != "accepted and completed" puts "" puts Rainbow ( "*" ) . blue * 70 puts "" puts "" puts "" puts "" puts "" puts "Okay, now get busy!" + Rainbow ( " (#{self.possibility.name})" ) . bright puts "" puts "When you are finished, come back and press:" puts "" puts "" puts "1. If you have completed this activity" puts "2. If you got distracted and failed to complete the activity" puts "" puts "" self . completed_activity = gets . strip self . quit if self . completed_activity == "quit" if [ "1" , "2" ] . all? { | i | self . completed_activity != i } self . what_was_that? self . complete_activity end if self . completed_activity == "1" self . activity . status = "accepted and completed" self . activity . save puts "" self . get_rating puts "" puts Rainbow ( "*" ) . blue * 70 puts "" puts "" puts "" puts "" puts "" puts "Thanks for your rating!" puts "" puts "" self . activity . activity_stats puts "" self . suggest_new_possibility? elsif self . completed_activity == "2" self . activity . status = "accepted but not completed" self . activity . save puts "" puts Rainbow ( "*" ) . blue * 70 puts "" puts "" puts "" puts "" self . suggest_new_possibility? end end end
Asks user about completion of possiblity and saves status of activity
Asks user about completion of possiblity and saves status of activity