DTL custom mention and comment grades
This commit is contained in:
parent
c4f7a5318a
commit
f5cdfba421
4 changed files with 60 additions and 22 deletions
|
|
@ -2,6 +2,7 @@ title: Design to Light
|
|||
|
||||
tabs:
|
||||
content:
|
||||
label: Contenu
|
||||
columns:
|
||||
- width: 1/1
|
||||
fields:
|
||||
|
|
@ -54,4 +55,31 @@ tabs:
|
|||
marks: false
|
||||
nodes:
|
||||
- bulletList
|
||||
|
||||
grades:
|
||||
label: Notes
|
||||
icon: badge
|
||||
fields:
|
||||
grades:
|
||||
label: Notes
|
||||
type: structure
|
||||
min: 5
|
||||
max: 5
|
||||
columns:
|
||||
letter:
|
||||
width: 1/10
|
||||
mention:
|
||||
width: 3/10
|
||||
comment:
|
||||
width: 6/10
|
||||
fields:
|
||||
letter:
|
||||
label: Lettre
|
||||
type: text
|
||||
disabled: true
|
||||
mention:
|
||||
type: text
|
||||
comment:
|
||||
label: Commentaire
|
||||
type: text
|
||||
files: tabs/files
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@ columns:
|
|||
currentStep:
|
||||
label: Étape en cours
|
||||
value: "{{ page.getStepLabel }}"
|
||||
isDTLEnabled:
|
||||
label: Design to light
|
||||
value: "{{ page.isDTLEnabled.value ? '✔' : '' }}"
|
||||
type: text
|
||||
empty: Pas encore de projet
|
||||
image: false
|
||||
search: true
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ fields:
|
|||
label: Note globale
|
||||
width: 2/10
|
||||
after: / 10
|
||||
help: Modifiez les mentions et commentaires associés aux notes [ici](/pages/design-to-light?tab=grades).
|
||||
|
||||
fields:
|
||||
DTLTargetHeadline:
|
||||
|
|
|
|||
|
|
@ -39,30 +39,35 @@ function getFileData($file) {
|
|||
}
|
||||
|
||||
function getGlobalEvaluation($numberedGrade) {
|
||||
$gradeMapping = [
|
||||
[0, 3, "D", "Assez lourd", "Allègement du flacon recommandé"],
|
||||
[3, 6, "C", "Assez lourd", "Allègement du flacon recommandé"],
|
||||
[6, 8, "B", "Assez lourd", "Allègement du flacon recommandé"],
|
||||
[8, 10, "A", "Léger", "Conception optimisée"],
|
||||
];
|
||||
|
||||
foreach ($gradeMapping as [$min, $max, $letter, $mention, $comment]) {
|
||||
if ($numberedGrade >= $min && $numberedGrade < $max) {
|
||||
return [
|
||||
"letter" => $letter,
|
||||
"number" => $numberedGrade,
|
||||
"mention" => $mention,
|
||||
"comment" => $comment,
|
||||
];
|
||||
}
|
||||
}
|
||||
$DTLPage = page('design-to-light');
|
||||
$DTLGrades = $DTLPage->grades()->toStructure();
|
||||
|
||||
return [
|
||||
"letter" => "",
|
||||
"number" => $numberedGrade,
|
||||
"mention" => "Non défini",
|
||||
"comment" => "Pas d'évaluation disponible",
|
||||
];
|
||||
$gradeMapping = [
|
||||
[0, 2, "E", $DTLGrades->findBy("letter", "E")->mention()->value(), $DTLGrades->findBy("letter", "E")->comment()->value()],
|
||||
[2, 4, "D", $DTLGrades->findBy("letter", "D")->mention()->value(), $DTLGrades->findBy("letter", "D")->comment()->value()],
|
||||
[4, 6, "C", $DTLGrades->findBy("letter", "C")->mention()->value(), $DTLGrades->findBy("letter", "C")->comment()->value()],
|
||||
[6, 8, "B", $DTLGrades->findBy("letter", "B")->mention()->value(), $DTLGrades->findBy("letter", "B")->comment()->value()],
|
||||
[8, 10, "A", $DTLGrades->findBy("letter", "A")->mention()->value(), $DTLGrades->findBy("letter", "A")->comment()->value()],
|
||||
];
|
||||
|
||||
foreach ($gradeMapping as [$min, $max, $letter, $mention, $comment]) {
|
||||
if ($numberedGrade >= $min && $numberedGrade < $max) {
|
||||
return [
|
||||
"letter" => $letter,
|
||||
"number" => $numberedGrade,
|
||||
"mention" => $mention,
|
||||
"comment" => $comment,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
"letter" => "",
|
||||
"number" => $numberedGrade,
|
||||
"mention" => "Non défini",
|
||||
"comment" => "Pas d'évaluation disponible",
|
||||
];
|
||||
}
|
||||
|
||||
function processDTLProposals($page) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue