Skip to content

Commit

Permalink
Merge pull request #479 from correctexam/471-suggestions-for-the-stud…
Browse files Browse the repository at this point in the history
…ent-view

471 suggestions for the student view
  • Loading branch information
barais authored Jan 28, 2024
2 parents d58acac + 13fde6c commit 7136b1f
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ <h2 id="jhi-course-heading" data-cy="CourseCreateUpdateHeading" jhiTranslate="sc
<th jhiTranslate="scanexam.lieneleve">LIEN</th>
<th jhiTranslate="scanexam.lienelevepdf">LIEN</th>
<th jhiTranslate="scanexam.envoimailpersonal">Envoi Mail</th>
<th jhiTranslate="scanexam.abiabj">ABI/ABJ</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-student>
Expand All @@ -207,8 +208,8 @@ <h2 id="jhi-course-heading" data-cy="CourseCreateUpdateHeading" jhiTranslate="sc
<td>{{ student.nom }}</td>
<td>{{ student.prenom }}</td>
<td>{{ student.mail }}</td>
<td *ngIf="!student.abi">{{ student.note }}</td>
<td *ngIf="student.abi">0</td>
<td *ngIf="student.abi === 0">{{ student.note }}</td>
<td *ngIf="student.abi > 0">0</td>
<td *ngIf="student.studentNumber">
<a
[pTooltip]="'scanexam.showresultLienProfTooltip' | translate"
Expand All @@ -219,8 +220,9 @@ <h2 id="jhi-course-heading" data-cy="CourseCreateUpdateHeading" jhiTranslate="sc
>correction</a
>
</td>
<td *ngIf="!student.studentNumber">ABI</td>
<td *ngIf="!student.abi">
<td *ngIf="student.abi == 1">ABI</td>
<td *ngIf="student.abi == 2">ABJ</td>
<td *ngIf="student.abi === 0">
<a
*ngIf="student.mail != '[email protected]'"
[pTooltip]="'scanexam.showresultLienEleveTooltip' | translate"
Expand All @@ -232,8 +234,9 @@ <h2 id="jhi-course-heading" data-cy="CourseCreateUpdateHeading" jhiTranslate="sc
>link</a
>
</td>
<td *ngIf="student.abi">ABI</td>
<td *ngIf="!student.abi">
<td *ngIf="student.abi == 1">ABI</td>
<td *ngIf="student.abi == 2">ABJ</td>
<td *ngIf="student.abi === 0">
<a
[pTooltip]="'scanexam.showresultLienPdfTooltip' | translate"
[tooltipPosition]="'top'"
Expand All @@ -244,7 +247,8 @@ <h2 id="jhi-course-heading" data-cy="CourseCreateUpdateHeading" jhiTranslate="sc
>pdf</a
>
</td>
<td *ngIf="student.abi">ABI</td>
<td *ngIf="student.abi == 1">ABI</td>
<td *ngIf="student.abi == 2">ABJ</td>
<td *ngIf="!student.abi">
<button
*ngIf="student.mail != '[email protected]'"
Expand All @@ -259,7 +263,16 @@ <h2 id="jhi-course-heading" data-cy="CourseCreateUpdateHeading" jhiTranslate="sc
<fa-icon icon="envelope"></fa-icon>
</button>
</td>
<td *ngIf="student.abi"></td>
<td *ngIf="student.abi > 0"></td>
<td *ngIf="student.abi === 0"></td>
<td *ngIf="student.abi > 0">
<p-inputSwitch
[trueValue]="2"
[falseValue]="1"
[(ngModel)]="student.abi"
(onChange)="updateStudentABJ(student)"
></p-inputSwitch>
</td>
</tr>
</ng-template>
</p-table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export class ResultatStudentcourseComponent implements OnInit {
this.http.get(this.applicationConfigService.getEndpointFor('api/showResult/' + this.examid)).subscribe(s => {
// eslint-disable-next-line no-console
this.studentsresult = s as any;

this.blocked = false;
});
}
Expand All @@ -174,10 +175,12 @@ export class ResultatStudentcourseComponent implements OnInit {
}

exportExcel(): void {
const studentsresult: any[] = JSON.parse(JSON.stringify(this.studentsresult));

this.loadLibelle().then(() => {
import('xlsx').then(xlsx => {
let maxQuestion = 0;
this.studentsresult.forEach(res => {
studentsresult.forEach(res => {
// eslint-disable-next-line no-console
for (const key in res.notequestions) {
// eslint-disable-next-line no-prototype-builtins
Expand All @@ -188,7 +191,7 @@ export class ResultatStudentcourseComponent implements OnInit {
}
}
});
this.studentsresult.forEach(res => {
studentsresult.forEach(res => {
for (let i = 1; i <= maxQuestion; i++) {
if (this.libelles[i] !== undefined && this.libelles[i] !== '') {
res['Q' + i + ' (' + this.libelles[i] + ')'] = undefined;
Expand All @@ -198,12 +201,18 @@ export class ResultatStudentcourseComponent implements OnInit {
}
});

this.studentsresult.forEach(res => {
studentsresult.forEach(res => {
if (res['note'] !== undefined && (typeof res['note'] === 'string' || res['note'] instanceof String)) {
res['note'] = parseFloat((res['note'] as any).replaceAll(',', '.'));
}
if (res['abi'] !== undefined) {
res['abi'] = !!res['abi'];
if (res['abi'] === 1) {
res['abi'] = 'ABI';
} else if (res['abi'] === 2) {
res['abi'] = 'ABJ';
} else {
res['abi'] = false;
}
}
for (const key in res.notequestions) {
// eslint-disable-next-line no-prototype-builtins
Expand All @@ -216,7 +225,10 @@ export class ResultatStudentcourseComponent implements OnInit {
}
}
});
const worksheet = xlsx.utils.json_to_sheet(this.studentsresult);
studentsresult.forEach((e: any) => delete e.notequestions);
studentsresult.forEach((e: any) => delete e.id);

const worksheet = xlsx.utils.json_to_sheet(studentsresult);
const workbook = { Sheets: { data: worksheet }, SheetNames: ['data'] };
const excelBuffer: any = xlsx.write(workbook, { bookType: 'xlsx', type: 'array' });
let filename = 'students';
Expand All @@ -241,8 +253,8 @@ export class ResultatStudentcourseComponent implements OnInit {
exportCSV(): void {
this.loadLibelle().then(() => {
let maxQuestion = 0;

this.studentsresult.forEach(res => {
const studentsresult: any[] = JSON.parse(JSON.stringify(this.studentsresult));
studentsresult.forEach(res => {
// eslint-disable-next-line no-console
for (const key in res.notequestions) {
// eslint-disable-next-line no-prototype-builtins
Expand All @@ -253,7 +265,7 @@ export class ResultatStudentcourseComponent implements OnInit {
}
}
});
this.studentsresult.forEach(res => {
studentsresult.forEach(res => {
for (let i = 1; i <= maxQuestion; i++) {
if (this.libelles[i] !== undefined && this.libelles[i] !== '') {
res['Q' + i + ' (' + this.libelles[i] + ')'] = undefined;
Expand All @@ -263,12 +275,18 @@ export class ResultatStudentcourseComponent implements OnInit {
}
});

this.studentsresult.forEach(res => {
studentsresult.forEach(res => {
if (res['note'] !== undefined && (typeof res['note'] === 'string' || res['note'] instanceof String)) {
res['note'] = parseFloat((res['note'] as any).replaceAll(',', '.'));
}
if (res['abi'] !== undefined) {
res['abi'] = !!res['abi'];
if (res['abi'] === 1) {
res['abi'] = 'ABI';
} else if (res['abi'] === 2) {
res['abi'] = 'ABJ';
} else {
res['abi'] = false;
}
}
for (const key in res.notequestions) {
// eslint-disable-next-line no-prototype-builtins
Expand All @@ -281,8 +299,8 @@ export class ResultatStudentcourseComponent implements OnInit {
}
}
});
const studentsresult = JSON.parse(JSON.stringify(this.studentsresult));
studentsresult.forEach((e: any) => delete e.notequestions);
studentsresult.forEach((e: any) => delete e.id);
// delete this.studentsresult.notequestions
const csv = generateCsv(csvConfig)(studentsresult);
if (this.exam?.name) {
Expand All @@ -292,6 +310,17 @@ export class ResultatStudentcourseComponent implements OnInit {
download(csvConfig)(csv);
});
}

updateStudentABJ(student: any): void {
if (student.id) {
firstValueFrom(
this.http.put(
this.applicationConfigService.getEndpointFor('api/toggleAsAbJ/' + student.id + '/' + this.examid + '/' + student.abi),
undefined,
),
);
}
}
}

function formatDate(date: Date): string {
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/app/scanexam/statsexam/statsexam.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export class StatsExamComponent implements OnInit {
this.infosStudents
.filter(s => s.ine !== '')
.forEach(s => {
if (s.abi) {
if (s.abi > 0) {
this.nbStdABI++;
} else {
for (const key in s.notequestions) {
Expand Down Expand Up @@ -763,7 +763,7 @@ interface StudentRes {
mail: string;
nom: string;
prenom: string;
abi: boolean;
abi: number;
note?: string;
notequestions: { [key: string]: string };
studentNumber?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ <h5 class="card-title">{{ comment.text }}</h5>
<h5 class="card-title">{{ comment.text }}</h5>
<p class="card-text">{{ comment.description }}</p>
<p *ngIf="comment.step && comment.step === 1">
<span *ngIf="comment.grade !== null && comment.grade !== undefined && comment.grade >= 0"> + </span> {{ comment.grade }}
<span *ngIf="comment.grade !== null && comment.grade !== undefined && comment.grade >= 0"> +</span> {{ comment.grade }}
<span *ngIf="!comment.relative"> pt</span> <span *ngIf="comment.relative"> %</span>
</p>
<p *ngIf="comment.step && comment.step > 1">
<span *ngIf="comment.grade !== null && comment.grade !== undefined && comment.grade >= 0"> + </span>
<span *ngIf="comment.grade !== null && comment.grade !== undefined && comment.grade >= 0"> +</span>
{{ (comment.grade! * comment.stepValue!) / comment.step! | number: '0.0-2' }} <span *ngIf="!comment.relative"> pt</span>
<span *ngIf="comment.relative"> %</span>
<BR />
Expand Down
3 changes: 2 additions & 1 deletion src/main/webapp/i18n/en/scanexammodule.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@
"contourLength": "Contour length",
"contourLengthAndNbreContour": "Length and number of contours",
"contourLengthTooltip": "One-dimensional Kmeans based on contour length",
"contourLengthAndNbreContourTooltip": "Two-dimensional Kmeans based on the length of contours and the number of contours with more than three pixels"
"contourLengthAndNbreContourTooltip": "Two-dimensional Kmeans based on the length of contours and the number of contours with more than three pixels",
"abiabj": "Excused absence"
}
}
3 changes: 2 additions & 1 deletion src/main/webapp/i18n/fr/scanexammodule.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@
"contourLength": "Longueur des contours",
"contourLengthAndNbreContour": "Longueur et nombre de contours",
"contourLengthTooltip": "Kmeans à une dimension fondé sur la longueur des contours",
"contourLengthAndNbreContourTooltip": "Kmeans à deux dimensions fondé sur la longueur des contours et le nombre de contours de plus de trois pixels"
"contourLengthAndNbreContourTooltip": "Kmeans à deux dimensions fondé sur la longueur des contours et le nombre de contours de plus de trois pixels",
"abiabj": "Absence justifiée"
}
}

0 comments on commit 7136b1f

Please sign in to comment.