Create Tasks for your Assignment!
diff --git a/frontend/src/app/components/create-assignment/create-assignment.component.ts b/frontend/src/app/components/create-assignment/create-assignment.component.ts
index 9c54eab0..378c9d3a 100644
--- a/frontend/src/app/components/create-assignment/create-assignment.component.ts
+++ b/frontend/src/app/components/create-assignment/create-assignment.component.ts
@@ -19,6 +19,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { AssignmentComponent } from '../assignment/assignment.component';
import { MatIconModule } from '@angular/material/icon';
import { TaskService } from '../../services/task.service';
+import { MatSnackBar } from '@angular/material/snack-bar';
@Component({
selector: 'app-create-assignment',
@@ -37,7 +38,7 @@ import { TaskService } from '../../services/task.service';
MatInputModule,
MatDateRangeInput,
MatNativeDateModule,
- MatButtonModule
+ MatButtonModule,
],
templateUrl: './create-assignment.component.html',
styleUrl: './create-assignment.component.less',
@@ -48,6 +49,7 @@ export class CreateAssignmentComponent implements OnInit {
@Output() showGroups: EventEmitter
= new EventEmitter
private readonly route = inject(ActivatedRoute);
+ private readonly snackBar = inject(MatSnackBar);
public learningPathId: string = "";
public language: string = "nl";
@@ -62,6 +64,8 @@ export class CreateAssignmentComponent implements OnInit {
public assignmentId: string = '';
public classMembers: User[] = [];
+ public enableCreate: boolean = true;
+
constructor(
private formBuilder: FormBuilder,
private classesService: ClassesService,
@@ -84,6 +88,12 @@ export class CreateAssignmentComponent implements OnInit {
}
+ checkNonEmpty(classId: string) {
+ this.classesService.usersInClass(classId).subscribe(
+ value => this.enableCreate = value.students.length > 0
+ )
+ }
+
create(): void {
const newAssignment: NewAssignment | null = this.extractFormValues();
@@ -101,6 +111,7 @@ export class CreateAssignmentComponent implements OnInit {
}
}
+
private getClasses(): void {
this.classesService.classesOfUser().subscribe((response: Class[]) => {
this.classes = response;
@@ -152,10 +163,10 @@ export class CreateAssignmentComponent implements OnInit {
// Initialize all empty tasks with an 'other'-type task without details
this.taskService.fillRestWithEmptyTasks(this.assignmentId).subscribe({
next: () => {
- console.log($localize`Assignment Created!`);
+ this.snackBar.open($localize`Assignment Created!`);
},
- error: (err) => {
- console.error(err);
+ error: () => {
+ this.snackBar.open($localize`Something went wrong!`);
}
});
@@ -164,4 +175,5 @@ export class CreateAssignmentComponent implements OnInit {
// we can redirect to assignments page
this.router.navigate(['/teacher/assignments']);
}
+
}
diff --git a/frontend/src/app/components/create-group/create-group.component.html b/frontend/src/app/components/create-group/create-group.component.html
index 17ac05c7..f7442a3a 100644
--- a/frontend/src/app/components/create-group/create-group.component.html
+++ b/frontend/src/app/components/create-group/create-group.component.html
@@ -5,12 +5,13 @@ Create groups
Here you can divide the members of your class into groups.
Drag a member into an existing group or onto the new group.
+ If you do not wish to assign a student to this assignment, you can keep them into the "Members" section.
Members
diff --git a/frontend/src/app/components/create-group/create-group.component.less b/frontend/src/app/components/create-group/create-group.component.less
index 29206ac4..1ebd7393 100644
--- a/frontend/src/app/components/create-group/create-group.component.less
+++ b/frontend/src/app/components/create-group/create-group.component.less
@@ -4,6 +4,7 @@
align-items: center;
justify-content: center;
+
gap: 20px;
}
diff --git a/frontend/src/app/components/create-group/create-group.component.ts b/frontend/src/app/components/create-group/create-group.component.ts
index 7e63b290..4b64468d 100644
--- a/frontend/src/app/components/create-group/create-group.component.ts
+++ b/frontend/src/app/components/create-group/create-group.component.ts
@@ -110,11 +110,11 @@ export class CreateGroupComponent {
* Make a call to the API to create the made groups.
*/
public createGroups(): void {
- if (this.members.length > 0) {
- this.openSnackBar($localize`There are still members not assigned to a group.`);
- } else {
- const nonEmptyGroups = this.groups.filter(group => group.length > 0);
+ const nonEmptyGroups = this.groups.filter(group => group.length > 0);
+ if (nonEmptyGroups.length === 0) {
+ this.openSnackBar($localize`You need to assign students!.`);
+ } else {
this.groupService.createGroups(nonEmptyGroups, this.assignmentId!)
.subscribe((response) => {
if (response) {
@@ -123,8 +123,10 @@ export class CreateGroupComponent {
} else {
this.openSnackBar($localize`Failed to create groups.`);
}
- })
+ });
}
+
+
}
/**
diff --git a/frontend/src/app/components/learning-path/learning-path.component.ts b/frontend/src/app/components/learning-path/learning-path.component.ts
index 527efa0f..efb94fbc 100644
--- a/frontend/src/app/components/learning-path/learning-path.component.ts
+++ b/frontend/src/app/components/learning-path/learning-path.component.ts
@@ -148,7 +148,6 @@ export class LearningPathComponent implements OnInit {
const resultNode = this.trajectoryGraph!.nodes[i];
if (resultNode) {
this.selectedNode = resultNode;
- console.log("in learning path", this.step)
this.selectedNodeChanged.emit(resultNode);
} else {
// First node, navigate back to assignments
diff --git a/frontend/src/app/components/manage-codes/manage-codes.component.ts b/frontend/src/app/components/manage-codes/manage-codes.component.ts
index abf7e408..2ceb261d 100644
--- a/frontend/src/app/components/manage-codes/manage-codes.component.ts
+++ b/frontend/src/app/components/manage-codes/manage-codes.component.ts
@@ -34,16 +34,14 @@ export class ManageCodesComponent implements OnInit {
public constructor(
private activeRoute: ActivatedRoute,
private classCodeService: ClassCodeService
- ) {}
+ ) { }
public ngOnInit(): void {
const id: string | null = this.activeRoute.snapshot.paramMap.get('id');
- console.log(id);
+ if (id) this._classId = id;
- if(id) this._classId = id;
-
- if(this._classId) {
+ if (this._classId) {
this.classCodeService.getClassCodes(this._classId)
.subscribe((codes: Code[]) => {
this._codes = codes;
@@ -64,7 +62,7 @@ export class ManageCodesComponent implements OnInit {
public expireClassCode(code: Code): void {
this.classCodeService.expireClassCode(code)
.subscribe(response => {
- if(!response) {
+ if (!response) {
this.openSnackBar($localize`Could not expire code`);
}
else {
@@ -77,7 +75,7 @@ export class ManageCodesComponent implements OnInit {
public deleteClassCode(code: Code): void {
this.classCodeService.deleteClassCode(code)
.subscribe(response => {
- if(!response) {
+ if (!response) {
this.openSnackBar($localize`Could not delete code`);
}
else {
@@ -88,15 +86,15 @@ export class ManageCodesComponent implements OnInit {
}
public createClassCode(): void {
- if(this._classId) this.classCodeService.createClassCode(this._classId)
- .subscribe(response => {
- if(!response) {
- this.openSnackBar($localize`Could not create code`);
- }
- else {
- this.openSnackBar($localize`Code created successfully`);
- location.reload();
- };
+ if (this._classId) this.classCodeService.createClassCode(this._classId)
+ .subscribe(response => {
+ if (!response) {
+ this.openSnackBar($localize`Could not create code`);
+ }
+ else {
+ this.openSnackBar($localize`Code created successfully`);
+ location.reload();
+ };
});
}
@@ -112,9 +110,9 @@ export class ManageCodesComponent implements OnInit {
this._codes = codes;
}
- private openSnackBar(message: string, action: string="Ok") {
+ private openSnackBar(message: string, action: string = "Ok") {
this.snackBar.open(message, action, {
- duration: 2500
+ duration: 2500
});
}
diff --git a/frontend/src/app/components/student-dashboard/student-dashboard.component.html b/frontend/src/app/components/student-dashboard/student-dashboard.component.html
index f0aedcd1..2ceebed3 100644
--- a/frontend/src/app/components/student-dashboard/student-dashboard.component.html
+++ b/frontend/src/app/components/student-dashboard/student-dashboard.component.html
@@ -8,65 +8,50 @@ Your assignments
@if (loadingProgress || loadingGroups) {
-