def get_user_info(user_id):
"""Retrieves user data based on the user ID."""
user = User.query.get(user_id)
user = user.__dict__
if '_sa_instance_state' in user:
del user['_sa_instance_state']
user_plants = get_user_plants(user_id)
user['plants'] = user_plants
# adds a key to dictionary that has a value of true/false depending on
# whether reminder was set
for plant in user['plants']:
user['plants'][plant]['reminder_status'] = str(get_reminder_status(user['user_id'], user['plants'][plant]['plant_id']))
return jsonify(user)
评论列表
文章目录