From 1694c8e3b4ba5378afb6b60e308b51445ffbdaad Mon Sep 17 00:00:00 2001 From: Oleksandra Lytvynets Date: Fri, 15 Apr 2022 18:13:22 +0300 Subject: [PATCH 1/3] fix --- src/app/shared/models/teacher.model.ts | 10 +++---- src/app/shared/models/workshop.model.ts | 30 ++++++++++++------- .../create-teacher.component.ts | 2 +- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/app/shared/models/teacher.model.ts b/src/app/shared/models/teacher.model.ts index 26e9c0dc50..379f853891 100644 --- a/src/app/shared/models/teacher.model.ts +++ b/src/app/shared/models/teacher.model.ts @@ -9,18 +9,18 @@ export class Teacher { avatarImage?: File[]; constructor(info) { - if (info.teacherId) { - this.id = info.teacherId; - } this.firstName = info.firstName; this.lastName = info.lastName; this.middleName = info.middleName; this.dateOfBirth = new Date(info.dateOfBirth).toISOString(); this.description = info.description; - if (info.avatarImage.length) { + if (info.teacherId) { + this.id = info.teacherId; + } + if (info.avatarImage?.length) { this.avatarImage = info.avatarImage[0]; } - if (info.avatarImageId) { + if (info.avatarImageId?.length) { this.avatarImageId = info.avatarImageId[0]; } } diff --git a/src/app/shared/models/workshop.model.ts b/src/app/shared/models/workshop.model.ts index f007b8abfe..0c93d956b0 100644 --- a/src/app/shared/models/workshop.model.ts +++ b/src/app/shared/models/workshop.model.ts @@ -40,9 +40,6 @@ export class Workshop { coverImageId?: string[]; constructor(about, description, address: Address, teachers: Teacher[], provider: Provider, id?: string) { - if (id) { - this.id = id; - } this.title = about.title; this.phone = about.phone; this.email = about.email; @@ -53,11 +50,7 @@ export class Workshop { this.description = description.description; this.address = address; this.teachers = teachers; - this.website = about.website; - this.facebook = about.facebook; - this.instagram = about.instagram; this.withDisabilityOptions = Boolean(description.disabilityOptionsDesc); - this.disabilityOptionsDesc = description.disabilityOptionsDesc; this.providerId = provider.id; this.providerTitle = provider.fullTitle; this.isPerMonth = about.isPerMonth; @@ -66,17 +59,32 @@ export class Workshop { this.classId = description.categories.classId.id; this.keywords = description.keyWords; this.dateTimeRanges = about.workingHours; + if (id) { + this.id = id; + } + if (about.facebook) { + this.facebook = about.facebook; + } + if (about.website) { + this.website = about.website; + } + if (about.instagram) { + this.instagram = about.instagram; + } + if (description.disabilityOptionsDesc) { + this.disabilityOptionsDesc = description.disabilityOptionsDesc; + } if (description.imageFiles.length) { this.imageFiles = description.imageFiles; } if (description.imageIds) { this.imageIds = description.imageIds; } - if (about.coverImage.length) { - this.coverImage = about.coverImage; + if (about.coverImage?.length) { + this.coverImage = about.coverImage[0]; } - if (about.coverImageId) { - this.coverImageId = about.coverImageId; + if (about.coverImageId?.length) { + this.coverImageId = about.coverImageId[0]; } } } diff --git a/src/app/shell/personal-cabinet/provider/create-workshop/create-teacher/create-teacher.component.ts b/src/app/shell/personal-cabinet/provider/create-workshop/create-teacher/create-teacher.component.ts index 83652f71f6..0cb55d103b 100644 --- a/src/app/shell/personal-cabinet/provider/create-workshop/create-teacher/create-teacher.component.ts +++ b/src/app/shell/personal-cabinet/provider/create-workshop/create-teacher/create-teacher.component.ts @@ -62,7 +62,7 @@ export class CreateTeacherComponent implements OnInit { */ private activateEditMode(teacherFormGroup: FormGroup, teacher): void { teacherFormGroup.patchValue(teacher, { emitEvent: false }); - teacherFormGroup.addControl('teacherId', this.fb.control([teacher.id])); + teacherFormGroup.addControl('teacherId', this.fb.control(teacher.id)); teacher.avatarImageId && teacherFormGroup.addControl('avatarImageId', this.fb.control([teacher.avatarImageId])); } From fa8d6343a77da865ea9372dc762d161d64a9970a Mon Sep 17 00:00:00 2001 From: Oleksandra Lytvynets Date: Fri, 15 Apr 2022 18:19:59 +0300 Subject: [PATCH 2/3] fix --- src/app/shared/models/workshop.model.ts | 4 ++-- src/app/shared/store/meta-data.state.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/shared/models/workshop.model.ts b/src/app/shared/models/workshop.model.ts index 0c93d956b0..b1a38483cd 100644 --- a/src/app/shared/models/workshop.model.ts +++ b/src/app/shared/models/workshop.model.ts @@ -74,10 +74,10 @@ export class Workshop { if (description.disabilityOptionsDesc) { this.disabilityOptionsDesc = description.disabilityOptionsDesc; } - if (description.imageFiles.length) { + if (description.imageFiles?.length) { this.imageFiles = description.imageFiles; } - if (description.imageIds) { + if (description.imageIds?.length) { this.imageIds = description.imageIds; } if (about.coverImage?.length) { diff --git a/src/app/shared/store/meta-data.state.ts b/src/app/shared/store/meta-data.state.ts index a4d461d4c7..99f75a95ef 100644 --- a/src/app/shared/store/meta-data.state.ts +++ b/src/app/shared/store/meta-data.state.ts @@ -238,10 +238,10 @@ export class MetaDataState { return this.featureManagementService .getFeaturesList() .pipe( - tap((featuresList: FeaturesList) => - patchState(environment.production - ? { featuresList: featuresList } - : { featuresList: { release1: true, release2: true, release3: false } }) + tap((featuresList: FeaturesList) => + patchState(environment.production + ? { featuresList: featuresList } + : { featuresList: { release1: true, release2: false, release3: false } }) )) } From 6ffedd540b95f9aeaf7c441c2fbafebf18d80776 Mon Sep 17 00:00:00 2001 From: Oleksandra Lytvynets Date: Mon, 18 Apr 2022 17:01:03 +0300 Subject: [PATCH 3/3] fix --- src/app/shared/models/teacher.model.ts | 1 + src/app/shared/store/meta-data.state.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/shared/models/teacher.model.ts b/src/app/shared/models/teacher.model.ts index 379f853891..11743d4e48 100644 --- a/src/app/shared/models/teacher.model.ts +++ b/src/app/shared/models/teacher.model.ts @@ -1,5 +1,6 @@ export class Teacher { id?: string; + workshopId?: string; firstName: string; lastName: string; middleName: string; diff --git a/src/app/shared/store/meta-data.state.ts b/src/app/shared/store/meta-data.state.ts index 99f75a95ef..b664f7bbad 100644 --- a/src/app/shared/store/meta-data.state.ts +++ b/src/app/shared/store/meta-data.state.ts @@ -241,7 +241,7 @@ export class MetaDataState { tap((featuresList: FeaturesList) => patchState(environment.production ? { featuresList: featuresList } - : { featuresList: { release1: true, release2: false, release3: false } }) + : { featuresList: { release1: true, release2: true, release3: false } }) )) }