class MediMed

Public Class Methods

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

Public Instance Methods

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

  @product_allergic_2.each do |prod|
    @customer_data[prod.id] = "Hi, "
    if (@medical_confirmation.disease == "yes")
       @customer_data[prod.id] << " We care a lot for you, Please consult doctor before having pizza's. Since, you have disease already which is prone to this." 
    else
        @customer_data[prod.id] << " How's your health."
        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] << " Good Choice."
                if(prod.calorie>250)
                    @customer_data[prod.id] << " Reminder: High calories to consume for your health condition."
                else
                    @customer_data[prod.id] << " You're medical condition is average and do frequent excersie to burn your calories accordingly."
                end
            end
        else
            @customer_data[prod.id] << " Regret!, this is #{prod.foodType}, pls check other products." 
        end
    end
  end
    return @customer_data
end