From e708974f6ab83bf34061e6c5e2b2140b43efbc11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Fri, 15 Nov 2024 14:24:58 +0100 Subject: [PATCH] fix: check oldStatus of order to send sync email --- webapp/CHANGELOG.md | 9 +++------ webapp/src/server/api/routers/order.ts | 3 ++- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/webapp/CHANGELOG.md b/webapp/CHANGELOG.md index 08fb379c..60fe5e1e 100644 --- a/webapp/CHANGELOG.md +++ b/webapp/CHANGELOG.md @@ -1,23 +1,20 @@ ## [0.64.1](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.64.0...v0.64.1) (2024-11-15) - ### Bug Fixes -* margin between blocs home ([92214ff](https://github.com/SocialGouv/carte-jeune-engage/commit/92214ff61bc23c50549ace6ac968403193a65fbd)) +- margin between blocs home ([92214ff](https://github.com/SocialGouv/carte-jeune-engage/commit/92214ff61bc23c50549ace6ac968403193a65fbd)) # [0.64.0](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.63.15...v0.64.0) (2024-11-15) - ### Features -* add recap order email on payment_completed and fix cje logo on login email ([ef31a2a](https://github.com/SocialGouv/carte-jeune-engage/commit/ef31a2a730b3bb653e175fc193ee5106a48380cc)) +- add recap order email on payment_completed and fix cje logo on login email ([ef31a2a](https://github.com/SocialGouv/carte-jeune-engage/commit/ef31a2a730b3bb653e175fc193ee5106a48380cc)) ## [0.63.15](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.63.14...v0.63.15) (2024-11-15) - ### Bug Fixes -* AvatarGroup to Image for load optimizations ([c41fbfa](https://github.com/SocialGouv/carte-jeune-engage/commit/c41fbfa44f106fec0b2800b649d5bf287a7a39c8)) +- AvatarGroup to Image for load optimizations ([c41fbfa](https://github.com/SocialGouv/carte-jeune-engage/commit/c41fbfa44f106fec0b2800b649d5bf287a7a39c8)) ## [0.63.14](https://github.com/SocialGouv/carte-jeune-engage/compare/v0.63.13...v0.63.14) (2024-11-15) diff --git a/webapp/src/server/api/routers/order.ts b/webapp/src/server/api/routers/order.ts index 5eabc4de..b338ce0c 100644 --- a/webapp/src/server/api/routers/order.ts +++ b/webapp/src/server/api/routers/order.ts @@ -316,6 +316,7 @@ export const orderRouter = createTRPCRouter({ newStatus !== order.status || resultOrderStatusObject.etats_statut !== order.obiz_status ) { + const oldStatus = order.status; order = await ctx.payload.update({ id: order_id, collection: "orders", @@ -325,7 +326,7 @@ export const orderRouter = createTRPCRouter({ }, }); - if (newStatus !== order.status && newStatus === "payment_completed") { + if (newStatus !== oldStatus && newStatus === "payment_completed") { const currentUser = await ctx.payload.findByID({ collection: "users", id: order.user as number,