From 7075590b4ab865bf8ca844e6dfdeb785a897b471 Mon Sep 17 00:00:00 2001 From: Georgi Prodanov Date: Fri, 3 Feb 2017 23:00:31 +0200 Subject: [PATCH] #328432 Fix error in checking for ability to unregister and add error for unexpected count of updated registrations when changing date vote. --- app/events/event-details/event-details.component.ts | 2 +- app/services/event-registrations.service.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/events/event-details/event-details.component.ts b/app/events/event-details/event-details.component.ts index 8e8ef28..e059981 100644 --- a/app/events/event-details/event-details.component.ts +++ b/app/events/event-details/event-details.component.ts @@ -202,7 +202,7 @@ export class EventDetailsComponent implements OnInit { } canUnregister() { - return this.alreadyRegistered && !this.isPastEvent && this.event.OpenForRegistration && !this.event.RegistrationCompleted; + return this.event && this.alreadyRegistered && !this.isPastEvent && this.event.OpenForRegistration && !this.event.RegistrationCompleted; } unregister() { diff --git a/app/services/event-registrations.service.ts b/app/services/event-registrations.service.ts index 01ca236..22c1e2f 100644 --- a/app/services/event-registrations.service.ts +++ b/app/services/event-registrations.service.ts @@ -54,7 +54,13 @@ export class EventRegistrationsService { updateChoices(eventId: string, userId: string, newChoices: string[]) { let filter = { EventId: eventId, UserId: userId }; - return this._data.update({ Choices: newChoices }, filter); + return this._data.update({ Choices: newChoices }, filter) + .then(resp => { + if (resp.result !== 1) { + return Promise.reject({ message: 'Unexpected number of updated records - check back end' }); + } + return resp; + }); } create(eventId: string, userId: string, dateChoices: string[]) {