AndyPaPaLeu / oop_final_project

MIT License
0 stars 0 forks source link

API: [Post] I want to update (create/delete) the items in an existed meal #21

Open AndyPaPaLeu opened 3 years ago

AndyPaPaLeu commented 3 years ago

[pathway] frontend -> person -> dailyIntake -> meal -> food person -> connecter -> meal table

[input] date, meal list

[output] None

JuliaHuang07 commented 3 years ago

########################### (e.g.在10/10晚餐, 增加apple) meal_query = {'name':'dinner','inTake':['burger','banana'],'time':datetime.strptime('2020-10-10-18:30:30', datetime_string_type)} #original new_item_info = {'name':'dinner','inTake':['apple'],'time':datetime.strptime('2020-10-10-18:30:30', datetime_string_type)} item = Meal(name=new_item_info['name'], time=new_item_info['time']) item.add_food(new_item_info['inTake']) print(item.food_summamry())

print('\nnew_item_info to existed dailyintake_dict')

for data in [new_item_info]: new_item=Meal(data['name'],data['time']) new_item.add_food(new_item_info['inTake']) dailyintake_dict[data['time'].strftime(date_string_type)].add_meal(new_item)

person.update_dailyIntakes(dailyintake_dict)

print('===take a look from person===') for date, daliyintake in person.get_dailyIntakes().items(): print(date,daliyintake.total_intake_calories) print(daliyintake.meal_detail()) ###########################