Fix eslint warnings

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2019-09-03 10:32:32 +02:00
parent 539d4cef8c
commit 155602b906
No known key found for this signature in database
GPG key ID: F941078878347C0C
4 changed files with 41 additions and 44 deletions

View file

@ -23,7 +23,7 @@
<template>
<div class="controls">
<div class="breadcrumb">
<button class="button btn primary" @click="helpPage">
<button class="button btn primary" @click="helpPage">
{{ "Help" }}
</button>
<div class="crumb svg crumbhome">

View file

@ -23,7 +23,7 @@
<li>
<div>{{ question.text }}</div>
<div>
<input v-show="(question.type != 'text') && (question.type != 'comment')" style="height:30px;" v-model="newQuizAnswer"
<input v-show="(question.type != 'text') && (question.type != 'comment')" v-model="newQuizAnswer" style="height:30px;"
:placeholder=" t('forms', 'Add Answer')"
@keyup.enter="emitNewAnswer(question)"
>
@ -40,8 +40,7 @@
:option="ans"
@remove="emitRemoveAnswer(question, index)"
@delete="question.answers.splice(index, 1)"
>
</li>
/>
</transitionGroup>
</div>
<div>

View file

@ -59,7 +59,7 @@
<option value="" disabled>
Select
</option>
<option v-for="option in options" v-bind:key="option.value" v-bind:value="option.value">
<option v-for="option in options" :key="option.value" :value="option.value">
{{ option.text }}
</option>
</select>
@ -84,11 +84,10 @@
:key="question.id"
:question="question"
:type="question.type"
v-on:add-answer="addAnswer"
v-on:remove-answer="removeAnswer"
:add-answer="addAnswer"
:remove-answer="removeAnswer"
@remove="form.options.formQuizQuestions.splice(index, 1)"
>
</li>
/>
</transitionGroup>
</div>
</div>

View file

@ -29,9 +29,7 @@
<span>{{ "Export to CSV" }}</span>
</button>
</div>
<h1>
{{ "Statistics" }}
</h1>
<h1>{{ "Statistics" }}</h1>
<div v-for="sum in stats" :key="sum">
{{ sum }}
</div>
@ -80,6 +78,39 @@ export default {
}
},
computed: {
stats() {
if (this.votes != null) {
var uniqueAns = []
var uniqueQs = []
var ansToQ = new Map()
for (let i = 0; i < this.votes.length; i++) {
if (this.votes[i].voteOptionType === 'radiogroup' || this.votes[i].voteOptionType === 'dropdown') {
if (uniqueAns.includes(this.votes[i].voteAnswer) === false) {
uniqueAns.push(this.votes[i].voteAnswer)
ansToQ.set(this.votes[i].voteAnswer, this.votes[i].voteOptionId)
}
if (uniqueQs.includes(this.votes[i].voteOptionId) === false) {
uniqueQs.push(this.votes[i].voteOptionId)
}
}
}
var sums = []
for (let i = 0; i < uniqueAns.length; i++) {
sums[i] = 0
}
for (let i = 0; i < this.votes.length; i++) {
sums[uniqueAns.indexOf(this.votes[i].voteAnswer)]++
}
for (let i = 0; i < sums.length; i++) {
sums[i] = 'Question ' + ansToQ.get(uniqueAns[i]) + ': ' + (sums[i] / ((this.votes.length / uniqueQs.length)) * 100).toFixed(2) + '%' + ' of respondents voted for answer choice: ' + uniqueAns[i]
}
}
return sums.sort()
}
},
created() {
this.indexPage = OC.generateUrl('apps/forms/')
this.loadForms()
@ -132,38 +163,6 @@ export default {
this.loading = false
})
}
},
computed: {
stats() {
if (this.votes != null) {
var uniqueAns = []
var uniqueQs = []
var ansToQ = new Map()
for (let i = 0; i < this.votes.length; i++) {
if (this.votes[i].voteOptionType === 'radiogroup' || this.votes[i].voteOptionType === 'dropdown') {
if (uniqueAns.includes(this.votes[i].voteAnswer) === false) {
uniqueAns.push(this.votes[i].voteAnswer)
ansToQ.set(this.votes[i].voteAnswer, this.votes[i].voteOptionId)
}
if (uniqueQs.includes(this.votes[i].voteOptionId) === false) {
uniqueQs.push(this.votes[i].voteOptionId)
}
}
}
var sums = []
for (let i = 0; i < uniqueAns.length; i++) {
sums[i] = 0
}
for (let i = 0; i < this.votes.length; i++) {
sums[uniqueAns.indexOf(this.votes[i].voteAnswer)]++
}
for (let i = 0; i < sums.length; i++) {
sums[i] = 'Question ' + ansToQ.get(uniqueAns[i]) + ': ' + (sums[i] / ((this.votes.length / uniqueQs.length)) * 100).toFixed(2) + '%' + ' of respondents voted for answer choice: ' + uniqueAns[i]
}
}
return sums.sort()
}
}
}
</script>