diff --git a/src/app/modules/monitoring/group-monitoring/group-monitoring.component.html b/src/app/modules/monitoring/group-monitoring/group-monitoring.component.html index cf3c876e..2cd83139 100644 --- a/src/app/modules/monitoring/group-monitoring/group-monitoring.component.html +++ b/src/app/modules/monitoring/group-monitoring/group-monitoring.component.html @@ -18,10 +18,14 @@ {{learner.index}}
{{learner.name}} {{learner.surname}} -
+
{{learner.completedTaskCount}}
{{learner.completedStepCount}}
+
+ circle + radio_button_off +
@@ -36,7 +40,7 @@
- +
diff --git a/src/app/modules/monitoring/group-monitoring/group-monitoring.component.ts b/src/app/modules/monitoring/group-monitoring/group-monitoring.component.ts index 9f6fd1f0..f8e86c08 100644 --- a/src/app/modules/monitoring/group-monitoring/group-monitoring.component.ts +++ b/src/app/modules/monitoring/group-monitoring/group-monitoring.component.ts @@ -4,6 +4,7 @@ import { Group } from '../model/group.model'; import { GroupMonitoringService } from './group-monitoring.service'; import { Learner } from '../model/learner.model'; import { TaskProgress } from '../grading/model/task-progress'; +import { WeeklyFeedbackService } from '../weekly-feedback/weekly-feedback.service'; @Component({ selector: 'cc-group-monitoring', @@ -19,7 +20,9 @@ export class GroupMonitoringComponent implements OnInit { learners: Learner[] = []; selectedLearner: Learner; - constructor(private route: ActivatedRoute, private groupMonitoringService: GroupMonitoringService) { } + feedbackDate: Date; + + constructor(private route: ActivatedRoute, private groupMonitoringService: GroupMonitoringService, private feedbackService: WeeklyFeedbackService) { } ngOnInit(): void { this.route.params.subscribe((params: Params) => { @@ -46,6 +49,7 @@ export class GroupMonitoringComponent implements OnInit { this.selectedLearner = null; this.learners = data.results.sort((l1, l2) => l1.name > l2.name ? 1 : -1); this.selectedLearner = this.learners[0]; + if(this.feedbackDate && this.mode === 'progress') this.getGroupFeedback(this.feedbackDate); }); } @@ -59,4 +63,19 @@ export class GroupMonitoringComponent implements OnInit { l.completedStepCount = taskProgress.filter(p => p.learnerId === l.id).flatMap(p => p.stepProgresses).filter(p => p.status === 'Answered').length; }); } + + public getGroupFeedback(date: Date) { + this.feedbackDate = date; + this.feedbackService.getByGroup(this.courseId, this.learners.map(l => l.id), date) + .subscribe(feedback => this.learners.forEach(l => { + const relatedFeedback = feedback.find(f => f.learnerId === l.id); + if(!relatedFeedback) { + l.semaphore = 0; + l.semaphoreJustification = ''; + return; + } + l.semaphore = relatedFeedback.semaphore; + l.semaphoreJustification = relatedFeedback.semaphoreJustification; + })); + } } diff --git a/src/app/modules/monitoring/model/learner.model.ts b/src/app/modules/monitoring/model/learner.model.ts index 4ecedb9b..a3952573 100644 --- a/src/app/modules/monitoring/model/learner.model.ts +++ b/src/app/modules/monitoring/model/learner.model.ts @@ -7,4 +7,8 @@ export interface Learner { // Grading summaries completedTaskCount: number; completedStepCount: number; + + // Feedback summaries + semaphore: number; + semaphoreJustification: string; } diff --git a/src/app/modules/monitoring/weekly-feedback/weekly-feedback.service.ts b/src/app/modules/monitoring/weekly-feedback/weekly-feedback.service.ts index 7a71130b..4abe2c3f 100644 --- a/src/app/modules/monitoring/weekly-feedback/weekly-feedback.service.ts +++ b/src/app/modules/monitoring/weekly-feedback/weekly-feedback.service.ts @@ -6,29 +6,33 @@ import { WeeklyFeedback } from './weekly-feedback.model'; @Injectable({providedIn: "root"}) export class WeeklyFeedbackService { - private baseUrl(courseId: number, learnerId: number): string { + private baseLearnerUrl(courseId: number, learnerId: number): string { return `${environment.apiHost}monitoring/${courseId}/feedback/${learnerId}/`; } constructor(private http: HttpClient) { } getByCourseAndLearner(courseId: number, learnerId: number): Observable { - return this.http.get(this.baseUrl(courseId, learnerId)) + return this.http.get(this.baseLearnerUrl(courseId, learnerId)) .pipe(map(results => { results.forEach(r => r.weekEnd = new Date(r.weekEnd)); return results; })); } + getByGroup(courseId: number, learnerIds: number[], weekEnd: Date): Observable { + return this.http.post(`${environment.apiHost}monitoring/${courseId}/feedback`, {learnerIds, weekEnd}); + } + create(courseId: number, learnerId: number, item: WeeklyFeedback): Observable { - return this.http.post(this.baseUrl(courseId, learnerId), item); + return this.http.post(this.baseLearnerUrl(courseId, learnerId), item); } update(courseId: number, learnerId: number, item: WeeklyFeedback): Observable { - return this.http.put(this.baseUrl(courseId, learnerId)+item.id, item); + return this.http.put(this.baseLearnerUrl(courseId, learnerId)+item.id, item); } delete(courseId: number, learnerId: number, itemId: number): Observable { - return this.http.delete(this.baseUrl(courseId, learnerId)+itemId); + return this.http.delete(this.baseLearnerUrl(courseId, learnerId)+itemId); } } diff --git a/src/app/modules/monitoring/weekly-progress/weekly-progress.component.html b/src/app/modules/monitoring/weekly-progress/weekly-progress.component.html index 4cf1c99f..a6ed11ec 100644 --- a/src/app/modules/monitoring/weekly-progress/weekly-progress.component.html +++ b/src/app/modules/monitoring/weekly-progress/weekly-progress.component.html @@ -1,11 +1,14 @@
+
Dan pred sastanak sa mentorom + +
Student nije imao nove lekcije u protekloj nedelji.
diff --git a/src/app/modules/monitoring/weekly-progress/weekly-progress.component.ts b/src/app/modules/monitoring/weekly-progress/weekly-progress.component.ts index 4228ff7a..728e0d99 100644 --- a/src/app/modules/monitoring/weekly-progress/weekly-progress.component.ts +++ b/src/app/modules/monitoring/weekly-progress/weekly-progress.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; +import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; import { Learner } from '../model/learner.model'; import { MatDatepickerInputEvent } from '@angular/material/datepicker'; import { WeeklyActivityService } from './weekly-activity.service'; @@ -12,15 +12,16 @@ import { WeeklyRatingStatistics, WeeklyProgressStatistics, calculateWeeklySatisf templateUrl: './weekly-progress.component.html', styleUrls: ['./weekly-progress.component.scss'] }) -export class WeeklyProgressComponent implements OnChanges { +export class WeeklyProgressComponent implements OnInit, OnChanges { @Input() courseId: number; @Input() selectedLearnerId: number; @Input() learners: Learner[]; @Output() learnerChanged = new EventEmitter(); groupMemberIds: Set; allRatings: UnitProgressRating[]; - + selectedDate: Date; + @Output() dateChanged = new EventEmitter(); units: UnitHeader[] = []; weeklyRatings: WeeklyRatingStatistics; @@ -30,6 +31,15 @@ export class WeeklyProgressComponent implements OnChanges { this.selectedDate = new Date(); } + ngOnInit() { + if(!this.learners?.length) return; + this.loadGroupSemaphores(); + } + + public loadGroupSemaphores() { + this.dateChanged.emit(this.selectedDate); + } + ngOnChanges(changes: SimpleChanges): void { if(!changes) return; @@ -50,6 +60,7 @@ export class WeeklyProgressComponent implements OnChanges { public onDateChange(event: MatDatepickerInputEvent) { if(!event?.value) return; this.selectedDate = event.value; + this.loadGroupSemaphores(); this.getUnits(); }