Skip to content

Commit

Permalink
Merge pull request #411 from correctexam/402-feedback-view-add-a-link…
Browse files Browse the repository at this point in the history
…-to-the-correction-view-for-instructors-feature-request

update block for resultat view
  • Loading branch information
barais authored Nov 26, 2023
2 parents 2f36166 + 670b2e8 commit d11668a
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ export class ExamDetailComponent implements OnInit, CacheUploadNotification, Cac
const ex2 = (this.students.map(s => s.examSheets) as any)
.flat()
.filter((ex1: any) => ex1.scanId === this.exam!.scanfileId && ex1.pagemin !== -1).length;
console.error(ex2, this.numberPagesInScan / this.nbreFeuilleParCopie, this.numberPagesInScan, this.nbreFeuilleParCopie);
this.showCorrection = ex2 === this.numberPagesInScan / this.nbreFeuilleParCopie && this.showAssociation && this.showAlignement;
},
() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class ResultatStudentcourseComponent implements OnInit {
this.mailabiBody = this.translate.instant('scanexam.mailabitemplate');
});
this.loadEtudiants();
this.loadLibelle();
// this.loadLibelle();
});
this.translate.onLangChange.subscribe(() => {
this.translate.get('scanexam.mailtemplate').subscribe(data => {
Expand Down Expand Up @@ -154,61 +154,61 @@ export class ResultatStudentcourseComponent implements OnInit {
});
}

loadLibelle(): void {
this.blocked = true;
this.http.get(this.applicationConfigService.getEndpointFor('api/getLibelleQuestions/' + this.examid)).subscribe(s => {
// eslint-disable-next-line no-console
this.libelles = s as any;
this.blocked = false;
});
async loadLibelle(): Promise<void> {
const l = (await firstValueFrom(
this.http.get(this.applicationConfigService.getEndpointFor('api/getLibelleQuestions/' + this.examid)),
)) as any;
this.libelles = l;
}

exportExcel(): void {
import('xlsx').then(xlsx => {
let maxQuestion = 0;
this.studentsresult.forEach(res => {
// eslint-disable-next-line no-console
for (const key in res.notequestions) {
// eslint-disable-next-line no-prototype-builtins
if (res.notequestions.hasOwnProperty(key)) {
if (+key > maxQuestion) {
maxQuestion = +key;
this.loadLibelle().then(() => {
import('xlsx').then(xlsx => {
let maxQuestion = 0;
this.studentsresult.forEach(res => {
// eslint-disable-next-line no-console
for (const key in res.notequestions) {
// eslint-disable-next-line no-prototype-builtins
if (res.notequestions.hasOwnProperty(key)) {
if (+key > maxQuestion) {
maxQuestion = +key;
}
}
}
}
});
this.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;
} else {
res['Q' + i] = undefined;
});
this.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;
} else {
res['Q' + i] = undefined;
}
}
}
});
});

this.studentsresult.forEach(res => {
if (res['note'] !== undefined) {
res['note'] = parseFloat(res['note'].replaceAll(',', '.'));
}
if (res['abi'] !== undefined) {
res['abi'] = !!res['abi'];
}
for (const key in res.notequestions) {
// eslint-disable-next-line no-prototype-builtins
if (res.notequestions.hasOwnProperty(key)) {
if (this.libelles[key] !== undefined && this.libelles[key] !== '') {
res['Q' + key + ' (' + this.libelles[key] + ')'] = parseFloat(res.notequestions[key].replaceAll(',', '.'));
} else {
res['Q' + key] = parseFloat(res.notequestions[key].replaceAll(',', '.'));
this.studentsresult.forEach(res => {
if (res['note'] !== undefined) {
res['note'] = parseFloat(res['note'].replaceAll(',', '.'));
}
if (res['abi'] !== undefined) {
res['abi'] = !!res['abi'];
}
for (const key in res.notequestions) {
// eslint-disable-next-line no-prototype-builtins
if (res.notequestions.hasOwnProperty(key)) {
if (this.libelles[key] !== undefined && this.libelles[key] !== '') {
res['Q' + key + ' (' + this.libelles[key] + ')'] = parseFloat(res.notequestions[key].replaceAll(',', '.'));
} else {
res['Q' + key] = parseFloat(res.notequestions[key].replaceAll(',', '.'));
}
}
}
}
});
const worksheet = xlsx.utils.json_to_sheet(this.studentsresult);
const workbook = { Sheets: { data: worksheet }, SheetNames: ['data'] };
const excelBuffer: any = xlsx.write(workbook, { bookType: 'xlsx', type: 'array' });
this.saveAsExcelFile(excelBuffer, 'students');
});
const worksheet = xlsx.utils.json_to_sheet(this.studentsresult);
const workbook = { Sheets: { data: worksheet }, SheetNames: ['data'] };
const excelBuffer: any = xlsx.write(workbook, { bookType: 'xlsx', type: 'array' });
this.saveAsExcelFile(excelBuffer, 'students');
});
}

Expand Down

0 comments on commit d11668a

Please sign in to comment.