diff --git a/modules/events/event.controller.js b/modules/events/event.controller.js index 6063b67..0b8a2e2 100644 --- a/modules/events/event.controller.js +++ b/modules/events/event.controller.js @@ -165,12 +165,14 @@ console.log('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', inscription.reservationId); + if (inscription.reservationId){ + console.log('Tengo reservation>>>>>>>>>>>>>>>>>>', inscription.reservationId); NewConfirmed = await eventInscriptionService._getCountInscriptionsWithReservation(EventOrReservationChangeId) marketingListId = (await eventReservationService._getReservaById(EventOrReservationChangeId)).marketing_list; } else if (inscription.overflowEventId) { + console.log('Tengo overflow>>>>>>>>>>>>>>>>>>', inscription.overflowEventId); NewConfirmed = await eventInscriptionService._getCountInscriptionsWithOverflowEventId(EventOrReservationChangeId); marketingListId = (await eventService._getEvent(EventOrReservationChangeId)).marketing_list; } @@ -182,11 +184,13 @@ console.log('Tengo reservation>>>>>>>>>>>>>>>>>>', inscription.reservationId); //Actualizamos aforo del evento o de la reserva if (inscription.reservationId){ console.log('>>>>>>>>>>>>>>Voy a actualizar aforo reserva'); +console.log('>>>>>>>>>>>>>> ', NewConfirmed); if (!await eventReservationService._updateConfirmedReservation(EventOrReservationChangeId, NewConfirmed)) return handleResultResponse("Error al eliminar inscripción, no puedo cambiar confirmados a la reserva asociada", null, params, res, httpStatus.NOT_FOUND); } else { console.log('>>>>>>>>>>>>>>Voy a actualizar aforo evento'); +console.log('>>>>>>>>>>>>>> ', NewConfirmed); if (!await eventService._updateConfirmedEvent(EventOrReservationChangeId, NewConfirmed)) return handleResultResponse("Error al eliminar inscripción, no puedo cambiar confirmados a la inscripcion", null, params, res, httpStatus.NOT_FOUND); @@ -448,7 +452,6 @@ console.log('No se ha podido actualizar el aforo del evento'); } - const marketingListOfInscription = dataInscription.event.marketing_list; /*AHORA SE ALMACENA TODO EN UNA ÚNICA LISTA DE MAILCHIMP, QUE ES LA DEL EVENTO (si en un futuro se quiere tener listas independientes, bastaría con tratarlo aqui los campos de marketinglist de la reserva ...) @@ -459,6 +462,7 @@ console.log('No se ha podido actualizar el aforo del evento'); else marketingListOfInscription = dataInscription.event.marketingList; */ + //Creamos objeto member para facilitar inserción en mailchimp y envio de correo var member = { marketing_memberId: null,