From f5447b408ea4c5f6e3237703c31201ba57a68fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Palma?= Date: Sun, 9 Feb 2025 15:52:36 +0000 Subject: [PATCH] fix: unable to accept direct exchanges from marketplace --- django/university/routes/exchange/DirectExchangeView.py | 5 ++++- .../university/routes/exchange/verify/ExchangeVerifyView.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/django/university/routes/exchange/DirectExchangeView.py b/django/university/routes/exchange/DirectExchangeView.py index 9773159..3e63f5e 100644 --- a/django/university/routes/exchange/DirectExchangeView.py +++ b/django/university/routes/exchange/DirectExchangeView.py @@ -214,7 +214,10 @@ def put(self, request, id): StudentController.populate_user_course_unit_data(int(participant.participant_nmec), erase_previous=True) if exchange.marketplace_exchange: - exchange.marketplace_exchange.delete() + marketplace_exchange = exchange.marketplace_exchange + exchange.marketplace_exchange = None + exchange.save() + marketplace_exchange.delete() ExchangeValidationController().cancel_conflicting_exchanges(int(exchange.id)) diff --git a/django/university/routes/exchange/verify/ExchangeVerifyView.py b/django/university/routes/exchange/verify/ExchangeVerifyView.py index c88c43e..55ab2bd 100644 --- a/django/university/routes/exchange/verify/ExchangeVerifyView.py +++ b/django/university/routes/exchange/verify/ExchangeVerifyView.py @@ -54,7 +54,10 @@ def post(self, request, token): StudentController.populate_user_course_unit_data(int(participant.participant_nmec), erase_previous=True) if direct_exchange.marketplace_exchange: - direct_exchange.marketplace_exchange.delete() + marketplace_exchange = direct_exchange.marketplace_exchange + direct_exchange.marketplace_exchange = None + direct_exchange.save() + marketplace_exchange.delete() ExchangeValidationController().cancel_conflicting_exchanges(int(exchange_info["exchange_id"]))