diff --git a/src/main/webapp/app/exercises/quiz/manage/apollon-diagrams/apollon-diagram-detail.component.ts b/src/main/webapp/app/exercises/quiz/manage/apollon-diagrams/apollon-diagram-detail.component.ts index 9ca9b4796321..6caa91f19a16 100644 --- a/src/main/webapp/app/exercises/quiz/manage/apollon-diagrams/apollon-diagram-detail.component.ts +++ b/src/main/webapp/app/exercises/quiz/manage/apollon-diagrams/apollon-diagram-detail.component.ts @@ -1,5 +1,5 @@ import { Component, ElementRef, OnDestroy, OnInit, ViewChild } from '@angular/core'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { ApollonEditor, ApollonMode, Locale, UMLModel } from '@ls1intum/apollon'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { JhiLanguageHelper } from 'app/core/language/language.helper'; @@ -52,6 +52,7 @@ export class ApollonDiagramDetailComponent implements OnInit, OnDestroy { private languageHelper: JhiLanguageHelper, private modalService: NgbModal, private route: ActivatedRoute, + private router: Router, ) {} /** @@ -153,6 +154,7 @@ export class ApollonDiagramDetailComponent implements OnInit, OnDestroy { */ async generateExercise() { if (!this.hasInteractive) { + this.alertService.error('artemisApp.apollonDiagram.create.validationError'); return; } @@ -165,6 +167,7 @@ export class ApollonDiagramDetailComponent implements OnInit, OnDestroy { const result = await modalRef.result; if (result) { this.alertService.success('artemisApp.apollonDiagram.create.success', { title: result.title }); + this.router.navigate(['course-management', this.courseId, 'quiz-exercises', result.id, 'edit']); } } catch (error) { this.alertService.error('artemisApp.apollonDiagram.create.error'); diff --git a/src/main/webapp/app/exercises/quiz/manage/apollon-diagrams/exercise-generation/quiz-exercise-generator.ts b/src/main/webapp/app/exercises/quiz/manage/apollon-diagrams/exercise-generation/quiz-exercise-generator.ts index 10128f71a4d1..0222ed96cf77 100644 --- a/src/main/webapp/app/exercises/quiz/manage/apollon-diagrams/exercise-generation/quiz-exercise-generator.ts +++ b/src/main/webapp/app/exercises/quiz/manage/apollon-diagrams/exercise-generation/quiz-exercise-generator.ts @@ -68,9 +68,9 @@ export async function generateDragAndDropQuizExercise( const quizExercise = createDragAndDropQuizExercise(course, title, dragAndDropQuestion); // Save the quiz exercise - await lastValueFrom(quizExerciseService.create(quizExercise)); + const creationResponse = await lastValueFrom(quizExerciseService.create(quizExercise)); - return quizExercise; + return creationResponse.body ?? quizExercise; } /** diff --git a/src/main/webapp/app/exercises/quiz/shared/questions/drag-and-drop-question/drag-and-drop-question.component.html b/src/main/webapp/app/exercises/quiz/shared/questions/drag-and-drop-question/drag-and-drop-question.component.html index 08f652e0df4a..6f8f8d96dfb7 100644 --- a/src/main/webapp/app/exercises/quiz/shared/questions/drag-and-drop-question/drag-and-drop-question.component.html +++ b/src/main/webapp/app/exercises/quiz/shared/questions/drag-and-drop-question/drag-and-drop-question.component.html @@ -96,6 +96,7 @@