def get_summary
#<break time='130ms'/>
motivate_quotes = ['The struggle you are in today is developing the strength you need for tomorrow🙂',
'The road may be bumpy but stay committed to the process🙂',
'If you are tired of starting over, stop giving up🙂',
'It’s not a diet, it’s a lifestyle change🙂',
'Will is a skill🙂',
'Stressed spelled backwards is desserts. coincidence? I think not!🙃',
'Strive for progress, not perfection💪',
'Success is never certain, failure is never final🙂',
'A goal without a plan is just a wish🙂']
obj = JSON.parse(IO.read('food_log.json'))
cal_sum = obj['cal_sum'].to_f
cal_limit = obj['cal_limit'].to_f
dif = (cal_limit - cal_sum)/cal_limit
if dif < -0.25
message = "You've exceeded your daily calorie limit a lot! \n"+ motivate_quotes.sample + "\nDon't worry, I'm here for you"
elsif dif < 0
message = "You've run out of your calorie limit for the day. Don't forget your plans~"
elsif dif < 0.15
message = "You have less than 300 calories left for your daily limit. That's about the amount of a light breakfast.🥪"
elsif dif < 0.25
message = "You have less than 500 calories left for your daily limit. That's about a hamburger, but I'm not suggesting you to eat that!😂"
else
message = "You have more than 500 calories left for your daily limit. That's more than a proper meal. Go ahead and enjoy the food!😀"
end
return message
end
Click to Expand
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .