From 35239003ae3d2e19b68e0886e8ed1673197d02f2 Mon Sep 17 00:00:00 2001 From: Mutugi <48474421+Mutugiii@users.noreply.github.com> Date: Tue, 21 Jan 2025 00:04:59 +0300 Subject: [PATCH] teams: smoother surveys routing (fixes #8108) (#8109) Co-authored-by: dogi --- package.json | 6 +++--- src/app/exams/exams-view.component.ts | 7 +++++-- src/app/users/users-update/users-update.component.ts | 5 +++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 209e02f65d..4f5851080e 100755 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "planet", "license": "AGPL-3.0", - "version": "0.16.67", + "version": "0.16.68", "myplanet": { - "latest": "v0.22.20", - "min": "v0.21.20" + "latest": "v0.22.23", + "min": "v0.21.23" }, "scripts": { "ng": "ng", diff --git a/src/app/exams/exams-view.component.ts b/src/app/exams/exams-view.component.ts index c9b70fe540..271f0bc3d2 100644 --- a/src/app/exams/exams-view.component.ts +++ b/src/app/exams/exams-view.component.ts @@ -7,7 +7,6 @@ import { UserService } from '../shared/user.service'; import { SubmissionsService } from '../submissions/submissions.service'; import { CouchService } from '../shared/couchdb.service'; import { FormControl, AbstractControl } from '@angular/forms'; -import { CustomValidators } from '../validators/custom-validators'; import { Exam, ExamQuestion } from './exams.model'; import { PlanetMessageService } from '../shared/planet-message.service'; import { DialogsAnnouncementComponent, includedCodes, challengeCourseId, challengePeriod } from '../shared/dialogs/dialogs-announcement.component'; @@ -51,6 +50,7 @@ export class ExamsViewComponent implements OnInit, OnDestroy { initialLoad = true; isLoading = true; courseId: string; + teamId = this.route.snapshot.params.teamId || null; constructor( private router: Router, @@ -192,7 +192,10 @@ export class ExamsViewComponent implements OnInit, OnDestroy { examComplete() { if (this.route.snapshot.data.newUser === true) { - this.router.navigate([ '/users/submission', { id: this.submissionId } ]); + this.router.navigate( + [ '/users/submission', { id: this.submissionId } ], + { queryParams: { teamId: this.teamId } } + ); } else { this.goBack(); } diff --git a/src/app/users/users-update/users-update.component.ts b/src/app/users/users-update/users-update.component.ts index 993bb4542e..80dd31c6fd 100644 --- a/src/app/users/users-update/users-update.component.ts +++ b/src/app/users/users-update/users-update.component.ts @@ -82,9 +82,10 @@ export class UsersUpdateComponent implements OnInit, CanComponentDeactivate { } ngOnInit() { - if (this.route.snapshot.data.submission === true) { + const routeSnapshot = this.route.snapshot; + if (routeSnapshot.data.submission === true) { this.submissionMode = true; - this.redirectUrl = '/manager/surveys'; + this.redirectUrl = routeSnapshot.queryParams.teamId ? `/teams/view/${routeSnapshot.queryParams.teamId}` : '/manager/surveys'; return; } this.urlName = this.route.snapshot.paramMap.get('name');