Commit 6bcfdad1 authored by Jérémie Passerat's avatar Jérémie Passerat

Ajout des unités dans xml calculée simple

parent c4ff6f76
......@@ -47,6 +47,9 @@
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px; width: 75px; margin-right: 5px" v-model="tolerance[j - 1]"/>
Type
<select v-model="typeTolerance">
<option v-for="i in optionType.length" :key="i">{{optionType[i - 1]}}</option>
</select>
</td>
......@@ -57,24 +60,83 @@
<td style="width: 30%; text-align: left">Affichage de la réponse</td>
<td style="width: 70%; text-align: left">
<input type="text" style="height: 25px; width: 75px; margin-right: 5px" v-model="tolerance[j - 1]"/>
<select v-model="tailleReponse">
<option v-for="i in 10" :key="i">{{i - 1}}</option>
</select>
Format
<select v-model="formatReponse" >
<option v-for="i in optionFormat.length" :key="i">{{optionFormat[i - 1]}}</option>
</select>
</td>
</tr>
<tr :key="j + 'feedback'">
<tr :key="j + 'feedback'" style="height: 225px">
<td style="width: 30%; text-align: left">Feedback</td>
<td style="width: 70%">
<quill-editor style="height: 100px; margin-top: 26px" v-model="feedback[j - 1]"/>
<quill-editor style="height: 100px; margin-top: -66px" v-model="feedback[j - 1]"/>
</td>
</tr>
</template>
<span class="nvelleReponse" @click="ajouterReponse"> Ajouter une réponse</span>
<!-- Traitement de l'unité -->
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Traitement de l'unité</td>
<td style="width: 70%; text-align: left">
<select v-model="traitementUnite" @change="changerOptions">
<option v-for="i in optionsTraitementUnite.length" :key="i">{{optionsTraitementUnite[i - 1]}}</option>
</select>
</td>
</tr>
<!-- <tr style="height: 69px">
<td style="width: 30%; text-align: left">Pénalité d'unité</td>
<td style="width: 70%">
</td>
</tr>-->
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Les unités sont saisies en utilisant</td>
<td style="width: 70%; text-align: left">
<select v-model="saisieUnite" :disabled="noUnit || optionalUnit">
<option v-for="i in optionsZoneSaisieUnite.length" :key="i">{{optionsZoneSaisieUnite[i - 1]}}</option>
</select>
</td>
</tr>
<tr style="height: 69px">
<td style="width: 30%; text-align: left">Position de l'unité</td>
<td style="width: 70%; text-align: left">
<select v-model="positionUnite" :disabled="noUnit">
<option v-for="i in optionsPositionUnite.length" :key="i">{{optionsPositionUnite[i - 1]}}</option>
</select>
</td>
</tr>
<!-- Unités -->
<template v-for="i in unites.length">
<tr style="height: 69px" :key="i + 'unite'">
<td style="width: 30%; text-align: left">Unité</td>
<td style="width: 70%; text-align: left">
<input type="text" style="width: 7vw; margin-right: 1vw" v-model="unites[i - 1]">
Coefficient
<input type="text" style="width: 7vw; margin-left: 1vw" v-model="unitesCoeffs[i - 1]" disabled>
</td>
</tr>
</template>
<span class="nvelleReponse" @click="ajouterUnite"> Ajouter une unité</span>
</table>
<button style="width: auto; height: auto; margin-left: -100px; position: fixed; bottom: 18px" v-on:click="action('modifier')">modifier</button>
<button style="width: auto; height: auto; margin-left: -15px; position: fixed; bottom: 18px" v-on:click="action('arriere')">retour en arriere</button>
</div>
</div>
</template>
......@@ -97,10 +159,80 @@ export default {
generalFeedback: '',
options: ["Aucun", "100%", "90%", "83.33%", "80%", "75%", "70%", "66.66%", "60%", "50%", "40%", "33.33%", "30%", "25%", "20%", "16.6667%", "14.28571%",
"12.5%", "11.11%", "10%", "5%"],
optionType: ["Relatif", "Nominal"],
optionFormat: ["decimal", "chiffres significatifs"],
optionsTraitementUnite: ["Les unités ne sont pas utilisees. Seule la valeur numérique est utilisée",
"Les unités sont optionelles. Si une unité est saisie, elle est utilisée pour la conversion de la réponse donnée vers l'unité 1 avant l'évaluation",
"L'unité doit être indiquée, et sera comprise dans la note" ],
optionsPenaliteUnite: ["comme une fraction entre 0 et 1 de la note de la question", "comme une fraction entre 0 et 1 de la note de la réponse"],
optionsZoneSaisieUnite: ["la zone de saisie du texte", "une sélection de choix multiple", "un menu déroulant"],
optionsPositionUnite: ['A droite, comme 2.5 cm ou 12.5 km', 'A gauche, comme € 2.5 ou $ 1.25'],
noUnit: false,
optionalUnit: false,
reponses: [],
notes: [],
feedback: [],
tolerance: []
tolerance: [],
typeTolerance: '',
formatReponse: '',
tailleReponse: '',
unites: [],
unitesCoeffs: [],
positionUnite: '',
saisieUnite: '',
traitementUnite: ''
}
},
methods: {
/**
* @vuese
* Récupération de l'action utilisateur
*
* @param actionChoisie
*/
action: function (actionChoisie) {
if (actionChoisie === 'arriere') {
this.$emit("actionMoodle", {action: actionChoisie})
} else {
this.questionParsee.nom_question = this.nomQuestion
this.questionParsee.intitule_question = this.texteQuestion
this.questionParsee.note_defaut = this.noteDefaut
this.questionParsee.feedback_general = this.generalFeedback
}
},
/**
* @vuese
* Modification des acces aux options de traitement de l'unite
*/
changerOptions: function () {
if (this.traitementUnite === this.optionsTraitementUnite[0]){
this.noUnit = true
this.optionalUnit = false
} else if (this.traitementUnite === this.optionsTraitementUnite[1]){
this.noUnit = false
this.optionalUnit = true
} else {
this.noUnit = false
this.optionalUnit = false
}
},
/**
* @vuese
* Ajouter une réponse au contenu
*/
ajouterReponse: function () {
this.reponses.push("")
this.notes.push(this.options[0])
this.feedback.push(" ")
this.tolerance.push("0")
},
/**
* @vuese
* Ajouter une unité au contenu
*/
ajouterUnite: function () {
this.unites.push("")
this.unitesCoeffs.push('1')
}
},
watch: {
......@@ -116,6 +248,27 @@ export default {
this.notes = this.notes.map(note => {if (note === '0%') return 'Aucun'; else return note;})
this.feedback = this.questionParsee.liste_feedback
this.tolerance = this.questionParsee.liste_tolerance
this.typeTolerance = this.optionType[parseInt(this.questionParsee.liste_tolerance_type) - 1]
this.tailleReponse = parseInt(this.questionParsee.liste_reponse_taille)
this.formatReponse = this.optionFormat[parseInt(this.questionParsee.liste_reponse_format) - 1]
this.unites = this.questionParsee.liste_unite_nom.filter(unite => unite)
this.unitesCoeffs = this.questionParsee.liste_unite_coef.filter(coef => coef)
this.positionUnite = this.optionsPositionUnite[this.questionParsee.position_unite]
this.saisieUnite = this.optionsZoneSaisieUnite[this.questionParsee.saisie_unite]
if (this.questionParsee.saisie_unite === "3") {
this.noUnit = true
this.traitementUnite = this.optionsTraitementUnite[this.questionParsee.traitement_unite]
this.saisieUnite = this.optionsZoneSaisieUnite[0]
}
else {
if (this.questionParsee.traitement_unite === '0'){
this.optionalUnit = true
}
this.traitementUnite = this.optionsTraitementUnite[parseInt(this.questionParsee.traitement_unite) + 1]
}
}
}
}
......@@ -129,7 +282,7 @@ label {
}
.edit {
width: 60vw;
width: 70vw;
margin-left: auto;
margin-right: auto;
height: 79.35vh;
......@@ -137,7 +290,7 @@ label {
}
.editDark {
width: 60vw;
width: 70vw;
margin-left: auto;
margin-right: auto;
height: 79.35vh;
......@@ -163,4 +316,12 @@ label {
td > * {
vertical-align: middle;
}
.nvelleReponse::before {
content: "\002B";
}
.nvelleReponse {
text-decoration: underline;
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment