class MediHigh

Public Class Methods

new(medical_confirmation) click to toggle source
Calls superclass method
# File lib/medical_strategy.rb, line 18
def initialize(medical_confirmation)
super()
@product_allergic_1 = Product.all
@medical_confirmation = medical_confirmation
@customer_data = []
end

Public Instance Methods

alltogether() click to toggle source
# File lib/medical_strategy.rb, line 25
def alltogether
    #@product_allergic = medical.@mallergic
    #@customer_data = medical.@customer
    #@medical_confirmation = medical.@mconfirmation

  @product_allergic_1.each do |prod|
    @customer_data[prod.id] = "Hi,How's your health. "
    if (@medical_confirmation.disease == "yes")
       @customer_data[prod.id] << " We care a lot for you, Please consult with doctor before having pizza's. Since, you have disease already which is prone to this." 
    else
        @customer_data[prod.id] << " Notice: Your are having high medical condition. "
        if (@medical_confirmation.foodHabit == prod.foodType)
            @customer_data[prod.id] << " This is your favorite food type."
            if (@medical_confirmation.allergens == prod.allergens) #&& @medical_confirmation.userName == @user_medical_check.firstName)
                @customer_data[prod.id] << " But You must choose different food. Since this is allergic to you." 
            else
                @customer_data[prod.id] << " That's a Good Choice."
                if(prod.calorie>250)
                    @customer_data[prod.id] << " Please avoid to consume. Your health condition doesn't permit high calories."
                else
                    @customer_data[prod.id] << " Please avoid to consume frequently and do frequent exercise to burn your calories. "
                end
            end
        else
            @customer_data[prod.id] << " Regret!, this is #{prod.foodType}, pls check other products." 
        end
    end
  end
 return @customer_data
end