Skip to content

Commit

Permalink
Merge pull request #132 from Clean-CaDET/development
Browse files Browse the repository at this point in the history
feat: Adds summary semaphore for each student for course monitoring.
  • Loading branch information
Luburic authored Dec 13, 2024
2 parents d314c1d + b3c30c4 commit 45924ba
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@
<h3>{{g.name}}</h3>
<div class="flex-row gap" style="flex-wrap: wrap;">
<mat-card *ngFor="let l of g.learners" appearance="outline" style="padding: 10px;">
<small>{{l.name}} {{l.surname}} <br>{{l.index}}</small><br>
<div class="flex-row" style="align-items: center;">
<small style="flex-grow: 1;">{{l.name}} {{l.surname}} <br>{{l.index}}</small>
<mat-icon style="scale: 1.5;" *ngIf="l.summarySemaphore != -1"
[color]="l.summarySemaphore == 1 ? 'warn' : l.summarySemaphore == 2 ? 'accent' : 'primary'"
[matTooltip]="l.summarySemaphore == 1 ? 'Kontaktiraj studenta' : l.summarySemaphore == 2 ? 'Proveri sa mentorom' : 'Sve ok'">circle</mat-icon>
</div>
<small *ngIf="!l.recentFeedback?.length">Mentor nije još ocenio.</small><br>
<table *ngIf="l.recentFeedback?.length">
<tr>
Expand All @@ -48,12 +53,12 @@ <h3>{{g.name}}</h3>
<td>
<mat-icon *ngIf="f.averageSatisfaction" [matTooltip]="f.averageSatisfaction"
[color]="f.averageSatisfaction < 2 ? 'warn' : f.averageSatisfaction >= 2.6 ? 'primary' : 'accent'">circle</mat-icon>
<mat-icon *ngIf="!f.averageSatisfaction">radio_button_unchecked</mat-icon>
<mat-icon *ngIf="!f.averageSatisfaction" matTooltip="Nije iskomunicirao zadovoljstvo u ovom periodu.">radio_button_unchecked</mat-icon>
</td>
<td>
<mat-icon *ngIf="f.achievedPercentage != -1" [matTooltip]="f.achievedPercentage+'%'"
[color]="f.achievedPercentage < 34 ? 'warn' : f.achievedPercentage > 67 ? 'primary' : 'accent'">circle</mat-icon>
<mat-icon *ngIf="f.achievedPercentage == -1">radio_button_unchecked</mat-icon>
<mat-icon *ngIf="f.achievedPercentage == -1" matTooltip="Nema zadataka za ocenjivanje u ovom periodu.">radio_button_unchecked</mat-icon>
</td>
</tr>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { Course } from '../../management/model/course.model';
import { Group } from '../model/group.model';
import { CourseMonitoringService } from './course-monitoring.service';
import { WeeklyFeedback } from '../weekly-feedback/weekly-feedback.model';

@Component({
selector: 'cc-course-monitoring',
Expand All @@ -25,6 +26,7 @@ export class CourseMonitoringComponent implements OnInit {
this.groups.forEach(g => {
g.learners.sort((l1, l2) => l1.name > l2.name ? 1 : -1);
g.learners.forEach(l => {
if(l.index.indexOf('@') > 0) l.index = l.index.split('@')[0];
l.recentFeedback = l.weeklyFeedback?.slice(-3) ?? [];
l.recentFeedback.forEach(f => {
if(!f.maxTaskPoints) {
Expand All @@ -33,8 +35,43 @@ export class CourseMonitoringComponent implements OnInit {
}
f.achievedPercentage = +(100 * f.achievedTaskPoints / f.maxTaskPoints).toFixed(0);
});
l.summarySemaphore = this.calculateSummarySemaphore(l.recentFeedback);
});
});
});
}

calculateSummarySemaphore(recentFeedback: WeeklyFeedback[]): number {
if(recentFeedback.length < 2) return -1;

let semaphores: number[] = [];
let satisfactions: number[] = [];
let scores: number[] = [];

recentFeedback.forEach(feedback => {
semaphores.push(feedback.semaphore);
if(feedback.averageSatisfaction) satisfactions.push(feedback.averageSatisfaction);
if(feedback.achievedPercentage != -1) scores.push(feedback.achievedPercentage);
});

return this.calculateSemaphoreWithKeyMetrics(this.weighValues(semaphores), this.weighValues(satisfactions), this.weighValues(scores));
}

weighValues(numbers: number[]): number {
if(numbers.length == 0) return -1;
if(numbers.length == 1) return numbers[0];
if(numbers.length == 2) return 0.6 * numbers[1] + 0.4 * numbers[0];
return 0.5 * numbers[2] + 0.33 * numbers[1] + 0.17 * numbers[0];
}

calculateSemaphoreWithKeyMetrics(semaphore: number, satisfaction: number, score: number): number {
if(satisfaction == -1 || score == -1) return -1;
if(semaphore < 1.67 || satisfaction < 2 || score < 34) return 1;

let blueCount = 0;
if(score > 67) blueCount++;
if(satisfaction >= 2.6) blueCount++;
if(semaphore > 2.3) blueCount++;
return blueCount < 2 ? 2 : 3;
}
}
1 change: 1 addition & 0 deletions src/app/modules/monitoring/model/learner.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export interface Learner {
// Course overview
recentFeedback?: WeeklyFeedback[];
weeklyFeedback?: WeeklyFeedback[];
summarySemaphore: number;
}

0 comments on commit 45924ba

Please sign in to comment.