From 7043e275b7ce2b9cc1715f34e0fa6dd39d9cf47b Mon Sep 17 00:00:00 2001 From: Olivier Barais Date: Fri, 4 Oct 2024 10:28:26 +0200 Subject: [PATCH 1/2] correct bug in cache for student view --- package.json | 8 ++++---- src/main/webapp/app/qcm.ts | 4 ++++ src/main/webapp/app/scanexam/db/dbstudent.ts | 4 ++-- .../app/scanexam/voirreponse/voirreponse.component.ts | 1 + 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 88481a6e..ac9f4c2c 100644 --- a/package.json +++ b/package.json @@ -30,10 +30,10 @@ "webapp:build": "npm run clean-www && npm run webapp:build:dev", "webapp:build:dev": "ng build --configuration development", "webapp:build:prod": "ng build --configuration production", - "webapp:build:prodgithubpage": "FRONT_URL=https://correctexam.github.io/corrigeExamFront/ SERVER_API_URL=https://api.gradescope.barais.fr/ ng build --configuration production --base-href=/corrigeExamFront/", - "webapp:build:prodlocal": "FRONT_URL=/ SERVER_API_URL=/ ng build --configuration production", - "webapp:build:prodnetlify": "FRONT_URL=https://correctexam.netlify.app/ SERVER_API_URL=https://api.gradescope.barais.fr/ ng build --configuration production --base-href=/", - "webapp:build:prodcloudfare": "FRONT_URL=https://correctexam.pages.dev/ SERVER_API_URL=https://api.gradescope.barais.fr/ ng build --configuration production --base-href=/", + "webapp:build:prodgithubpage": "npm run clean-www && FRONT_URL=https://correctexam.github.io/corrigeExamFront/ SERVER_API_URL=https://api.gradescope.barais.fr/ ng build --configuration production --base-href=/corrigeExamFront/", + "webapp:build:prodlocal": "npm run clean-www && FRONT_URL=/ SERVER_API_URL=/ ng build --configuration production", + "webapp:build:prodnetlify": "npm run clean-www && FRONT_URL=https://correctexam.netlify.app/ SERVER_API_URL=https://api.gradescope.barais.fr/ ng build --configuration production --base-href=/", + "webapp:build:prodcloudfare": "npm run clean-www && FRONT_URL=https://correctexam.pages.dev/ SERVER_API_URL=https://api.gradescope.barais.fr/ ng build --configuration production --base-href=/", "webapp:dev": "FRONT_URL=/ SERVER_API_URL=/ ng serve", "webapp:dev-ssl": "ng serve --ssl", "webapp:dev-verbose": "ng serve --verbose", diff --git a/src/main/webapp/app/qcm.ts b/src/main/webapp/app/qcm.ts index 99ca9e49..9116b2a3 100644 --- a/src/main/webapp/app/qcm.ts +++ b/src/main/webapp/app/qcm.ts @@ -509,6 +509,7 @@ function analyseStudentSheet(casesExamTemplate: any, templateimage: any, student casesExamTemplate.cases.forEach((case1: any, k: number) => { const diff = diffCouleurAvecCaseBlanche(decoupe(thresh, getPosition(case1), getDimensions(case1))); imgs_templatediffblank.set(k, diff); + console.error(diff, k); }); gray.delete(); thresh.delete(); @@ -520,6 +521,9 @@ function analyseStudentSheet(casesExamTemplate: any, templateimage: any, student const diff1 = diffCouleurAvecCaseBlanche(img_case_eleve); // img_case_eleve.delete(); const diff = diff1 - imgs_templatediffblank.get(k)!; + + console.error(diff1, imgs_templatediffblank.get(k), k); + // console.error('diff',k,diff1-imgs_templatediffblank.get(k)!,diff1, imgs_templatediffblank.get(k)); if (diff > preference.qcm_differences_avec_case_blanche) { infos_cases.set(k, { verdict: true, prediction: diff }); diff --git a/src/main/webapp/app/scanexam/db/dbstudent.ts b/src/main/webapp/app/scanexam/db/dbstudent.ts index bb4d809e..a3eea91b 100644 --- a/src/main/webapp/app/scanexam/db/dbstudent.ts +++ b/src/main/webapp/app/scanexam/db/dbstudent.ts @@ -145,11 +145,11 @@ export class AppDB extends Dexie { } async countNonAlignWithPageNumber(examId: number, pageInscan: number) { - return await this.nonAlignImages.where({ examId: examId, pageInscan }).count(); + return await this.nonAlignImages.where({ examId: examId, pageNumber: pageInscan }).count(); } async countAlignWithPageNumber(examId: number, pageInscan: number) { - return await this.alignImages.where({ examId: examId, pageInscan }).count(); + return await this.alignImages.where({ examId: examId, pageNumber: pageInscan }).count(); } } diff --git a/src/main/webapp/app/scanexam/voirreponse/voirreponse.component.ts b/src/main/webapp/app/scanexam/voirreponse/voirreponse.component.ts index da827169..6d5b561b 100644 --- a/src/main/webapp/app/scanexam/voirreponse/voirreponse.component.ts +++ b/src/main/webapp/app/scanexam/voirreponse/voirreponse.component.ts @@ -253,6 +253,7 @@ export class VoirReponseComponent implements OnInit, AfterViewInit { } async getAllImage4Zone(pageInscan: number, zone: IZone): Promise { + console.error('no align'); if (this.noalign) { return new Promise((resolve, reject) => { db.countNonAlignWithPageNumber(+this.exam!.id!, pageInscan).then(count => { From e06ce2665993dc66ab917b53088d16b6092e2def Mon Sep 17 00:00:00 2001 From: Olivier Barais Date: Fri, 4 Oct 2024 10:39:00 +0200 Subject: [PATCH 2/2] fix log --- .../app/scanexam/corrigequestion/corrigequestion.component.ts | 4 ++-- .../webapp/app/scanexam/voirreponse/voirreponse.component.ts | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/webapp/app/scanexam/corrigequestion/corrigequestion.component.ts b/src/main/webapp/app/scanexam/corrigequestion/corrigequestion.component.ts index b0baa0f6..736fbd06 100644 --- a/src/main/webapp/app/scanexam/corrigequestion/corrigequestion.component.ts +++ b/src/main/webapp/app/scanexam/corrigequestion/corrigequestion.component.ts @@ -334,9 +334,9 @@ export class CorrigequestionComponent implements OnInit, AfterViewInit { updateTitle(): void { this.activatedRoute.data.subscribe(e => { - console.error('title', this.exam); + // console.error('title', this.exam); this.translateService.get(e['pageTitle'], { examName: this.exam?.name, courseName: this.exam?.courseName }).subscribe(e1 => { - console.error('settitle', e1); + // console.error('settitle', e1); this.titleService.setTitle(e1); }); }); diff --git a/src/main/webapp/app/scanexam/voirreponse/voirreponse.component.ts b/src/main/webapp/app/scanexam/voirreponse/voirreponse.component.ts index 6d5b561b..da827169 100644 --- a/src/main/webapp/app/scanexam/voirreponse/voirreponse.component.ts +++ b/src/main/webapp/app/scanexam/voirreponse/voirreponse.component.ts @@ -253,7 +253,6 @@ export class VoirReponseComponent implements OnInit, AfterViewInit { } async getAllImage4Zone(pageInscan: number, zone: IZone): Promise { - console.error('no align'); if (this.noalign) { return new Promise((resolve, reject) => { db.countNonAlignWithPageNumber(+this.exam!.id!, pageInscan).then(count => {