Skip to content

Commit

Permalink
Merge branch 'develop' into quickFix
Browse files Browse the repository at this point in the history
  • Loading branch information
jvJUCA authored Apr 23, 2024
2 parents 49525d5 + 13c10d2 commit 1aead84
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 40 deletions.
48 changes: 29 additions & 19 deletions src/components/organisms/HeuristicsTestAnswer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
color="#FCA326"
class="ml-4"
>
<v-tab @click="tab = 0">
<v-tab @click=";(tab = 0), (ind = 0)">
Statistics
</v-tab>
<v-tab @click="tab = 1">
<v-tab @click=";(tab = 1), (ind = 0)">
Evaluators
</v-tab>
<v-tab @click="tab = 2">
<v-tab @click=";(tab = 2), (ind = 0)">
Heuristics
</v-tab>
<v-tab @click="tab = 3">
<v-tab @click=";(tab = 3), (ind = 0)">
Analytics
</v-tab>
</v-tabs>
Expand Down Expand Up @@ -180,7 +180,13 @@
"
:data="evaluatorStatistics.items.map((item) => item.result)"
/>
<v-card v-else flat class="mx-auto mt-10 mb-10 py-6 px-3 if-card" align="center" width="970px">
<v-card
v-else
flat
class="mx-auto mt-10 mb-10 py-6 px-3 if-card"
align="center"
width="970px"
>
The graphic can only be generated with 3 or more evaluators,
please colect more data from your research to procede.
</v-card>
Expand Down Expand Up @@ -286,7 +292,9 @@
<div style="padding-top: 2px; padding-bottom: 2px">
<v-chip
style="width: 35%"
:color="getColor(item.average, item.max, item.min)"
:color="
getColor(item.average, item.max, item.min)
"
dark
>
{{ item.percentage }}
Expand Down Expand Up @@ -318,25 +326,29 @@
align="center"
width="970px"
>
This page needs weight function (python) to be running, can be in
emulators or in deploy mode, and the weights to be full marked on your creating test page.
This page needs weight function (python) to be running,
can be in emulators or in deploy mode, and the weights
to be full marked on your creating test page.
</v-card>
<div v-else>
<v-row align="center" justify="space-around">
<v-col cols="6" md="4">
<v-col md="4" sm="8">
<v-card
align="center"
class=" elevation-4 weightsStatisticsStyle mt-6 py-4 mb-6 mx-auto"
class="elevation-4 weightsStatisticsStyle mt-6 py-4 mb-6 mx-auto"
width="950px"
>
<v-card-title class="mt-4 mb-4 font-weight-bold">
<v-row align="center" justify="center">
Usability Percentage <br>
Usability Percentage <br />
With Weights
</v-row>
</v-card-title>
<v-card-text>
<v-row align="center" justify="center mt-2 mb-2">
<v-row
align="center"
justify="center mt-2 mb-2"
>
<p class="display-3">
{{ usabilityTotalFix }}
</p>
Expand All @@ -358,9 +370,7 @@
)
"
:data="
weightsStatistics.items.map(
(item) => item.rw,
)
weightsStatistics.items.map((item) => item.rw)
"
:maxValue="maxValue"
/>
Expand Down Expand Up @@ -453,7 +463,9 @@ export default {
value: 'heuristic',
})
if (this.resultEvaluator) {
let evaluatorIndex = 1
this.resultEvaluator.forEach((evaluator) => {
evaluator.id = `Ev${evaluatorIndex}`
const header = table.header.find((h) => h.text == evaluator.id)
if (!header) {
table.header.push({
Expand All @@ -477,6 +489,7 @@ export default {
})
}
})
evaluatorIndex++
})
}
return table
Expand Down Expand Up @@ -595,7 +608,6 @@ export default {
usabilityTotalFix() {
const usabilityTotalFix = parseFloat(this.usability_total).toFixed(2)
console.log(this.maxValue)
return usabilityTotalFix
},
Expand All @@ -604,11 +616,10 @@ export default {
let maxValue = relative[0]
for (let i = 1; i < relative.length; i++) {
if (relative[i] > maxValue) {
maxValue = relative[i]
maxValue = relative[i]
}
}
const maxplus = parseFloat(maxValue).toFixed(1)
console.log(maxplus)
return maxplus
},
Expand Down Expand Up @@ -725,7 +736,6 @@ export default {
console.error('Erro ao chamar Cloud Function:', erro)
}
},
},
}
</script>
Expand Down
3 changes: 3 additions & 0 deletions src/store/modules/Answer.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ export default {
]

if (payload.resultEvaluator) {
let evaluatorIndex = 1
payload.resultEvaluator.forEach((evaluator) => {
evaluator.id = `Ev${evaluatorIndex}`
let totalNoAplication = 0
let totalNoReply = 0
let totalQuestions = 0
Expand All @@ -210,6 +212,7 @@ export default {
).toFixed(2),
lastUpdate: new Date(evaluator.lastUpdate).toLocaleString(),
})
evaluatorIndex++
})
}

Expand Down
45 changes: 25 additions & 20 deletions src/utils/statistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ function percentage(value, result) {
}

function standardDeviation(array) {
const average = array.reduce((total, value) => total + value / array.length, 0)
const average = array.reduce(
(total, value) => total + value / array.length,
0,
)
return Math.sqrt(
array.reduce(
(total, valor) => total + Math.pow(average - valor, 2) / array.length,
Expand Down Expand Up @@ -43,7 +46,7 @@ function calcFinalResult(array) {
})

const perfectResult = (qtdQuestion - qtdNoAplication) * maxOption
return ((result * 100) / perfectResult).toFixed(1)
return ((result * 100) / perfectResult).toFixed(2)
}

function answers() {
Expand All @@ -66,43 +69,43 @@ function created(resultEvaluator) {
function statistics() {
if (store.getters.testAnswerDocument?.type === 'HEURISTICS') {
const resultEvaluator = []
const answersA = answers()

//Get Evaluator answers
let evaluatorIndex = 1
answersA.forEach((evaluator) => {
answers().forEach((evaluator) => {
let SelectEvaluator = resultEvaluator.find(
(e) => e.userDocId == `Ev${evaluatorIndex}`,
(e) => e.userDocId == evaluator.userDocId,
)

if (!SelectEvaluator) {
resultEvaluator.push({
userDocId: evaluator.userDocId,
email: '[email protected]',
id: `Ev${evaluatorIndex}`,
id: evaluator.userDocId,
heuristics: [],
result: 0,
lastUpdate: evaluator.lastUpdate,
})
SelectEvaluator = resultEvaluator[resultEvaluator.length - 1]
} else {
// Update lastUpdate if evaluator already exists
SelectEvaluator.lastUpdate = evaluator.lastUpdate
}

//Get Heuristics for evaluators
let heurisIndex = 1
evaluator.heuristicQuestions.forEach((heuristic) => {
//Get Questions for heuristic

let noAplication = 0
let noReply = 0
let res = heuristic.heuristicQuestions.reduce(
(totalQuestions, question) => {
//grouping of answers
if (question.heuristicAnswer === null) {
noAplication++
} //count answers no aplication
}
if (question.heuristicAnswer === '') noReply++
return totalQuestions + Number(question.heuristicAnswer) //sum of responses
return totalQuestions + Number(question.heuristicAnswer)
},
0,
)

if (noAplication == heuristic.heuristicQuestions.length) res = null

SelectEvaluator.heuristics.push({
Expand All @@ -114,15 +117,17 @@ function statistics() {
})
heurisIndex++
})
evaluatorIndex++
})

//Calc Final result
// Sort resultEvaluator based on lastUpdate
resultEvaluator.sort((a, b) => b.lastUpdate - a.lastUpdate)

// Calc Final result
resultEvaluator.forEach((ev) => {
ev.result = calcFinalResult(ev.heuristics)
})

// created(resultEvaluator)
console.log(resultEvaluator)
return resultEvaluator
}
}
Expand All @@ -134,19 +139,19 @@ function finalResult() {
return total + value.result / evaluatorStatistics.items.length
}, 0)

testData.average = `${Math.fround(res).toFixed(1)}%`
testData.average = `${Math.fround(res).toFixed(2)}%`

testData.max = `${Math.max(
...evaluatorStatistics.items.map((item) => item.result),
).toFixed(1)}%`
).toFixed(2)}%`

testData.min = `${Math.min(
...evaluatorStatistics.items.map((item) => item.result),
).toFixed(1)}%`
).toFixed(2)}%`

testData.sd = `${standardDeviation(
evaluatorStatistics.items.map((item) => item.result),
).toFixed(1)}%`
).toFixed(2)}%`
}
return testData
}
Expand Down
1 change: 0 additions & 1 deletion src/views/public/TestView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,6 @@
"
class="optionSelect"
:items="test.testOptions"
:item-value="i.toString()"
label="Respuestas/Answers"
outlined
dense
Expand Down

0 comments on commit 1aead84

Please sign in to comment.