From e1a65a4c8618dd76659ef20ff7526e23c85d234c Mon Sep 17 00:00:00 2001 From: Roberto Fontanarosa Date: Mon, 9 Feb 2026 16:51:21 +0100 Subject: [PATCH 1/2] passed still survey instead of draft one --- .../components/edit-survey/edit-survey.component.html | 4 ++-- .../components/edit-survey/edit-survey.component.ts | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/web/src/app/components/edit-survey/edit-survey.component.html b/web/src/app/components/edit-survey/edit-survey.component.html index d21a571ea..9eff29da9 100644 --- a/web/src/app/components/edit-survey/edit-survey.component.html +++ b/web/src/app/components/edit-survey/edit-survey.component.html @@ -16,8 +16,8 @@
diff --git a/web/src/app/components/edit-survey/edit-survey.component.ts b/web/src/app/components/edit-survey/edit-survey.component.ts index 4a64a7eed..0b5b11f61 100644 --- a/web/src/app/components/edit-survey/edit-survey.component.ts +++ b/web/src/app/components/edit-survey/edit-survey.component.ts @@ -37,6 +37,9 @@ import { DialogType, JobDialogComponent, } from './job-dialog/job-dialog.component'; +import { toObservable, toSignal } from '@angular/core/rxjs-interop'; +import { switchMap } from 'rxjs'; +import { SurveyService } from 'app/services/survey/survey.service'; @Component({ selector: 'edit-survey', @@ -48,11 +51,18 @@ export class EditSurveyComponent { private jobService = inject(JobService); private draftSurveyService = inject(DraftSurveyService); private navigationService = inject(NavigationService); + private surveyService = inject(SurveyService); public dialog = inject(MatDialog); private editSurveyPageSignal = this.navigationService.getEditSurveyPageSignal(); + surveyId = input(); + activeSurvey = toSignal( + toObservable(this.surveyId).pipe( + switchMap(id => (id ? this.surveyService.loadSurvey$(id) : [])) + ) + ); survey?: Survey; production = !!(environment as Environment)['production']; From 9333503879cd0306d24a82e0984a32295175fe8b Mon Sep 17 00:00:00 2001 From: Roberto Fontanarosa Date: Mon, 9 Feb 2026 17:11:17 +0100 Subject: [PATCH 2/2] fixed test --- .../app/components/edit-survey/edit-survey.component.spec.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/src/app/components/edit-survey/edit-survey.component.spec.ts b/web/src/app/components/edit-survey/edit-survey.component.spec.ts index fa18a9fdb..32186d9d9 100644 --- a/web/src/app/components/edit-survey/edit-survey.component.spec.ts +++ b/web/src/app/components/edit-survey/edit-survey.component.spec.ts @@ -106,10 +106,15 @@ describe('EditSurveyComponent', () => { surveyServiceSpy = jasmine.createSpyObj('SurveyService', [ 'canManageSurvey', + 'loadSurvey$', ]); + surveyServiceSpy.loadSurvey$.and.returnValue(of(survey)); + surveyServiceSpy.canManageSurvey.and.returnValue(true); + activeSurvey$ = new Subject(); surveySubject$ = new BehaviorSubject(survey); + draftSurveyServiceSpy = jasmine.createSpyObj( 'DraftSurveyService', ['init', 'getSurvey$', 'addOrUpdateJob', 'deleteJob', 'getSurvey']