Skip to content

Commit

Permalink
Merge pull request #403 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

402 feedback view add a link to the correction view for instructors feature request
  • Loading branch information
barais authored Nov 23, 2023
2 parents e72c348 + e58e312 commit c031b47
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 8 deletions.
12 changes: 11 additions & 1 deletion src/main/webapp/app/scanexam/voircopie/voircopie.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,21 @@ <h2 *ngIf="questionNumeros.length > questionindex">
<span *ngIf="bestSolutions.length === 0" jhiTranslate="scanexam.nogoodsolution">Aucune bonne solution identifiée</span>
</div>
<div class="d-flex justify-content-center">
<a target="_blank" [href]="getEmail()" jhiTranslate="scanexam.echangemail"
<a *ngIf="email !== ''" target="_blank" [href]="email" jhiTranslate="scanexam.echangemail"
>Echange avec l'équipe pédagogique suite à une incompréhension de la correction</a
>
</div>
<div style="padding-top: 1rem; padding-bottom: 1rem"></div>
<div *jhiHasAnyAuthority="['ROLE_USER', 'ROLE_ADMIN']" class="d-flex justify-content-center">
<a
*ngIf="correctionLink"
target="_blank"
[routerLink]="correctionLink"
jhiTranslate="scanexam.gotoCorrection"
[pTooltip]="'scanexam.gotoCorrectionTooltipView' | translate"
>Aller à la vue correction</a
>
</div>
</div>

<div class="col-12 sm:col-12 md:col-12 lg:col-3 xl:col-2">
Expand Down
33 changes: 28 additions & 5 deletions src/main/webapp/app/scanexam/voircopie/voircopie.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export class VoirCopieComponent implements OnInit, AfterViewInit {
uuid = '';
sheet: IExamSheet | undefined;
resolve: any;
correctionLink: string | undefined;
note = new Promise<number>(resolve => {
this.resolve = resolve;
});
Expand Down Expand Up @@ -144,10 +145,11 @@ export class VoirCopieComponent implements OnInit, AfterViewInit {
this.questionindex = +params.get('questionno')! - 1;

// Step 1 Query templates

this.correctionLink = '/answer/' + this.exam.id! + '/' + params.get('questionno') + '/' + (this.currentStudent + 1);
this.nbreFeuilleParCopie = this.sheet!.pagemax! - this.sheet!.pagemin! + 1;
// Step 2 Query Scan in local DB
this.finalize().then(() => {
this.initEmail();
this.populateBestSolutions();
});
}
Expand Down Expand Up @@ -465,8 +467,17 @@ export class VoirCopieComponent implements OnInit, AfterViewInit {
return value;
}
}
getEmail(): string {

email: string = '';

async initEmail() {
if (this.selectionStudents !== undefined && this.exam !== undefined && this.questions !== undefined) {
const courseid = this.exam.courseId;
const emailsObj = await firstValueFrom(
this.http.get<any>(this.applicationConfigService.getEndpointFor('api/getAllEmailProfs4course/' + courseid)),
);
const emails: (string | undefined)[] = emailsObj.emails;

const firsName = this.selectionStudents![0].firstname!;
const lastName = this.selectionStudents![0].name!;
const examName = this.exam!.name!;
Expand Down Expand Up @@ -494,12 +505,24 @@ ${firsName}
`;

if (this.translateService.currentLang === 'fr') {
return "mailto:?subject=Retour sur l'examen " + this.exam!.name + '&body=' + tfr;
this.email =
'mailto:' +
emails.filter(e => e !== undefined && e !== '').join(',') +
"?subject=Retour sur l'examen " +
this.exam!.name +
'&body=' +
tfr;
} else {
return 'mailto:?subject=Feedback on your ewam ' + this.exam!.name + '&body=' + ten;
this.email =
'mailto:' +
emails.filter(e => e !== undefined && e !== '').join(',') +
'?subject=Feedback on your ewam ' +
this.exam!.name +
'&body=' +
ten;
}
} else {
return '';
this.email = '';
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/main/webapp/i18n/en/scanexammodule.json
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,8 @@
"colour": "Color: ",
"colourTooltip": "Choice of color for text and lines",
"scalefactor": "Scaling :",
"scalefactorTooltip": "Used to change the page scaling factor"
"scalefactorTooltip": "Used to change the page scaling factor",
"gotoCorrection": "Go to correction view",
"gotoCorrectionTooltipView": "Used to go to the correction view when you are logged in as a teacher"
}
}
4 changes: 3 additions & 1 deletion src/main/webapp/i18n/fr/scanexammodule.json
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,8 @@
"colour": "Couleur : ",
"colourTooltip": "Choix de la couleur pour le texte et les traits",
"scalefactor": "Mise à l'échelle :",
"scalefactorTooltip": "Permet de changer le facteur de mise à l'échelle"
"scalefactorTooltip": "Permet de changer le facteur de mise à l'échelle",
"gotoCorrection": "Aller à la correction",
"gotoCorrectionTooltipView": "Permet d'aller à la vue correction quand on est authentifié en tant que prof"
}
}

0 comments on commit c031b47

Please sign in to comment.