From edfcd03da3832cd53edc89deb898219b9885b806 Mon Sep 17 00:00:00 2001 From: nfesta2023 <142601504+nfesta2023@users.noreply.github.com> Date: Sun, 14 Apr 2024 15:01:09 +0700 Subject: [PATCH] update customer profile (#12) Co-authored-by: NHT --- .../nuti-expert/nuti-expert.service.ts | 4 ++-- src/feature/customer/customer.service.ts | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/dependency/nuti-expert/nuti-expert.service.ts b/src/dependency/nuti-expert/nuti-expert.service.ts index 583be8b..c4f719f 100644 --- a/src/dependency/nuti-expert/nuti-expert.service.ts +++ b/src/dependency/nuti-expert/nuti-expert.service.ts @@ -75,11 +75,11 @@ export class NutiExpertService { }, data: data, }; - console.log(config); + // console.log(config); const request = this.httpService.request(config); const result = await lastValueFrom(request); - console.log(result.data); + // console.log(result.data); return { bmi: result.data.result.chiSoBMI.result.bmi, recommended_dietary_allowance_kcal: diff --git a/src/feature/customer/customer.service.ts b/src/feature/customer/customer.service.ts index 2826788..ca12b4f 100644 --- a/src/feature/customer/customer.service.ts +++ b/src/feature/customer/customer.service.ts @@ -188,13 +188,7 @@ export class CustomerService { const healthInfo = await this.healthInfoRepo.findOneBy({ health_info_id: customer.health_info.health_info_id, }); - healthInfo.height_m = height_m; - healthInfo.weight_kg = weight_kg; - healthInfo.physical_activity_level = physical_activity_level; - healthInfo.current_diet = current_diet; - healthInfo.allergic_food = allergic_food; - healthInfo.chronic_disease = chronic_disease; - healthInfo.expected_diet = expected_diet; + /* //Recalculate BMI & Recommended dietary allowance kcal //Only if there is an update in: @@ -219,6 +213,13 @@ export class CustomerService { healthInfo.recommended_dietary_allowance_kcal = recommended_dietary_allowance_kcal; } + healthInfo.height_m = height_m; + healthInfo.weight_kg = weight_kg; + healthInfo.physical_activity_level = physical_activity_level; + healthInfo.current_diet = current_diet; + healthInfo.allergic_food = allergic_food; + healthInfo.chronic_disease = chronic_disease; + healthInfo.expected_diet = expected_diet; const newHealthInfo = await this.healthInfoRepo.save(healthInfo); customer.health_info = newHealthInfo; } @@ -267,7 +268,6 @@ export class CustomerService { }); const data = await upload.done(); - console.log('respose upload data', data); if (data) { return data; } else {