Skip to content

Commit

Permalink
Merge pull request #456 from ruxailab/HeuristicIssues
Browse files Browse the repository at this point in the history
Heuristic issues
jvJUCA authored Apr 23, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 4b39694 + dd8e37c commit b63df13
Showing 21 changed files with 74 additions and 134 deletions.
41 changes: 10 additions & 31 deletions src/components/atoms/ListComponent.vue
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@
<v-avatar tile :color="generateColor()" style="color: #545454">
<span
v-if="type === 'myTemplates' || type === 'publicTemplates'"
>{{ item.header.templateTitle[0].toUpperCase() }}</span>
>{{ item.header.templateTitle[0].toUpperCase() }}</span
>
<span v-else>{{ item.testTitle[0].toUpperCase() }}</span>
</v-avatar>
</v-list-item-avatar>
@@ -41,8 +42,8 @@
item.testAdmin
? item.testAdmin.email
: item.header
? item.header.templateAuthor.userEmail
: ''
? item.header.templateAuthor.userEmail
: ''
}}</strong>
</v-list-item-subtitle>
</v-list-item-content>
@@ -52,14 +53,6 @@
<v-list-item-action-text
v-if="item.accessLevel != null && item.accessLevel != undefined"
>
<v-chip
label
outlined
class="my-1"
:color="getAccessLevelColor(item.accessLevel)"
>
{{ getAccessLevelText(item.accessLevel) }}
</v-chip>
</v-list-item-action-text>
<v-list-item-action-text v-if="item.updateDate">
<v-row class="ma-0" align="center">
@@ -86,10 +79,8 @@
</v-tooltip>
<v-tooltip v-else-if="type === 'sharedWithMe'" top>
<template v-slot:activator="{ on, attrs }">
<v-row v-bind="attrs" v-on="on">
<div class="caption">
{{ item.progress }}%
</div>
<v-row class="mr-3" v-bind="attrs" v-on="on">
<div class="caption">{{ item.progress }}%</div>

<v-progress-circular
rotate="-90"
@@ -134,10 +125,12 @@
type === 'publicTests' ||
type === 'sharedWithMe'
"
>{{ $t('pages.listTests.noTests') }}</span>
>{{ $t('pages.listTests.noTests') }}</span
>
<span
v-else-if="type === 'myTemplates' || type === 'publicTemplates'"
>{{ $t('pages.listTests.noTemplates') }}</span>
>{{ $t('pages.listTests.noTemplates') }}</span
>
</v-row>
</v-list>
</div>
@@ -200,20 +193,6 @@ export default {
const d = new Date(date)
return d.toLocaleString()
},
getAccessLevelText(accessLevel) {
return accessLevel === 0
? 'Administrator'
: accessLevel === 1
? 'Evaluator'
: 'Guest'
},
getAccessLevelColor(accessLevel) {
return accessLevel === 0
? 'primary'
: accessLevel === 1
? 'secondary'
: 'warning'
},
generateColor() {
const hue = Math.floor(Math.random() * 360)
const color = 'hsl(' + hue + ', 80%, 80%)'
2 changes: 1 addition & 1 deletion src/components/atoms/NotificationButton.vue
Original file line number Diff line number Diff line change
@@ -107,7 +107,7 @@ export default {
user: this.user,
})
// Redirect to notification url
window.open(notification.redirectsTo)
this.$router.go(`${notification.redirectsTo}`)
},
checkIfHasNewNotifications() {
const newNot = this.user.notifications.filter((n) => n.read === false)
2 changes: 0 additions & 2 deletions src/components/molecules/FeedbackView.vue
Original file line number Diff line number Diff line change
@@ -99,7 +99,6 @@ export default {
},
methods: {
async toggleScreen() {
console.log('toggleScreen')
if (!this.isSharingScreen) {
await this.$refs.VideoCall.switchMediaStream()
this.isSharingScreen = true
@@ -119,7 +118,6 @@ export default {
const audioTrack = this.localStream
.getTracks()
.find((track) => track.kind == 'audio')
console.log(audioTrack)
audioTrack.enabled = !audioTrack.enabled
this.isMicrophoneMuted = !audioTrack.enabled
}
2 changes: 0 additions & 2 deletions src/components/molecules/ListTasks.vue
Original file line number Diff line number Diff line change
@@ -139,9 +139,7 @@ export default {
},
deleteItem(item) {
const index = this.allTasks.indexOf(item)
console.log(index)
confirm('Are you sure you want to delete this task?')
console.log(item)
this.allTasks.splice(index, 1)
},
addTask() {
6 changes: 3 additions & 3 deletions src/components/molecules/TemplateInfoDialog.vue
Original file line number Diff line number Diff line change
@@ -32,8 +32,8 @@
template.header.templateVersion == '1.0.0'
? ` on ${getFormattedDate(template.header.creationDate)}`
: ` - Last updated: ${getFormattedDate(
template.header.updateDate,
)}`
template.header.updateDate,
)}`
}}
({{
$t('pages.listTests.version') +
@@ -185,7 +185,7 @@ export default {
methods: {
async deleteTemplate() {
if (!confirm($t('alerts.deleteTest'))) return
if (!confirm('are you sure, you to delete the template?')) return
await this.$store.dispatch('deleteTemplate', this.template.id)
this.reset()
7 changes: 0 additions & 7 deletions src/components/molecules/VideoCall.vue
Original file line number Diff line number Diff line change
@@ -166,7 +166,6 @@ export default {
const roomSnapshot = await getDoc(roomRef)
console.log('Got room:', roomSnapshot.exists)
if (roomSnapshot.exists) {
this.peerConnection = new RTCPeerConnection(this.configuration)
@@ -273,7 +272,6 @@ export default {
}
},
async hangUp() {
console.log('hang up')
const tracks = this.localStream.getTracks()
tracks.forEach((track) => {
track.stop()
@@ -302,28 +300,23 @@ export default {
// Verificando se o documento da sala existe antes de tentar excluí-lo
const roomSnapshot = await getDoc(roomRef)
if (roomSnapshot.exists()) {
console.log('Room document exists. Deleting...')
const calleeCandidatesSnapshot = await getDocs(
collection(roomRef, 'calleeCandidates'),
)
calleeCandidatesSnapshot.forEach(async (candidate) => {
await deleteDoc(candidate.ref)
console.log('Deleted callee candidate:', candidate.id)
})
const callerCandidatesSnapshot = await getDocs(
collection(roomRef, 'callerCandidates'),
)
callerCandidatesSnapshot.forEach(async (candidate) => {
await deleteDoc(candidate.ref)
console.log('Deleted caller candidate:', candidate.id)
})
await deleteDoc(roomRef)
console.log('Deleted room document:', this.roomId)
} else {
console.log('Room document does not exist.')
}
} catch (error) {
console.error('Error deleting room and candidates:', error)
2 changes: 0 additions & 2 deletions src/components/organisms/GeneralAnalytics.vue
Original file line number Diff line number Diff line change
@@ -264,7 +264,6 @@ export default {
},
},
created() {
console.log(this.test)
let i = 0
this.testStructure.userTasks.forEach((task) => {
this.testTasks[i] = task.taskName
@@ -400,7 +399,6 @@ export default {
this.taskAnswers.forEach((answer) => {
if (answer.lastUpdate > this.taskAnswers[0].lastUpdate) {
console.log('entrou no for')
latestResponse = answer.userDocId
lastUpdate = answer.lastUpdate
}
22 changes: 2 additions & 20 deletions src/components/organisms/HeuristicsAnalytics.vue
Original file line number Diff line number Diff line change
@@ -13,8 +13,6 @@
<v-col class="ma-0 pa-0" cols="2">
<v-list outlined rounded dense height="560px">
<v-subheader>Heuristics</v-subheader>
{{ resultHeuristics.length }}
{{ heuristicsLength }}
<v-divider />
<v-list
color="grey-lighten-3"
@@ -23,7 +21,6 @@
class="list-scroll"
>
<v-list-item-group v-model="heuristicSelect" color="#fca326">

<v-list-item v-for="(item, i) in resultHeuristics" :key="i">
<v-list-item-content>
<v-list-item-title>{{ item.id }}</v-list-item-title>
@@ -85,6 +82,7 @@
test.testStructure[heuristicSelect]
"
class="ma-0 pa-0"
cols="7"
>
<v-card outlined rounded flat height="560px" elevation-0>
<v-subheader v-if="questionSelect != -1" class="pa-2">
@@ -253,6 +251,7 @@ export default {
},
)
}
return header
},
itemsHeuristic() {
@@ -270,7 +269,6 @@ export default {
})
},
)
console.log('aaaaaa ', this.resultHeuristics)
}
return items
},
@@ -307,12 +305,6 @@ export default {
test() {
return this.$store.getters.test
},
heuristics() {
return this.$store.state.Tests.Test.testStructure || []
},
heuristicsLength() {
return this.heuristics.length
},
},
watch: {
answers() {
@@ -344,9 +336,6 @@ export default {
let index = 0
for (const uid in this.answers) {
//console.log('answers ', this.answers)
if (!this.answers[uid]) {
continue
}
@@ -356,8 +345,6 @@ export default {
let SelectHeuristic = this.resultHeuristics.find(
(h) => h.id === `H${index}`,
)
//console.log('heuristic ' , heuristic)
//console.log('resultHeuristics ', this.resultHeuristics)
if (!SelectHeuristic) {
this.resultHeuristics.push({
@@ -370,9 +357,6 @@ export default {
]
}
//console.log('SelectHeuristic ',SelectHeuristic)
//console.log('heuristicQuestions', heuristic.heuristicQuestions)
heuristic.heuristicQuestions.forEach((hQuestion) => {
hQuestion.heuristicQuestions.forEach((question, qIndex) => {
const selectQuestion = SelectHeuristic.questions.find(
@@ -401,9 +385,7 @@ export default {
})
index++
// console.log(uid)
}
},
goToCoops() {
this.$emit('goToCoops')
1 change: 1 addition & 0 deletions src/components/organisms/UnmoderatedCoopsView.vue
Original file line number Diff line number Diff line change
@@ -382,6 +382,7 @@ export default {
author: `${this.test.testAdmin.email}`,
read: false,
testId: this.test.id,
accessLevel: this.roleOptions[this.selectedRole].value,
}),
})
}
1 change: 0 additions & 1 deletion src/controllers/TestController.js
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@ export default class TestController extends Controller {
// return await super.delete(COLLECTION, payload.id)
// }
async deleteTest(payload) {
console.log(payload)
try {
console.log('Inicio do delete test')
const testToDelete = await super.readOne(COLLECTION, payload.id)
9 changes: 3 additions & 6 deletions src/controllers/UserController.js
Original file line number Diff line number Diff line change
@@ -43,7 +43,6 @@ export default class UserController extends Controller {

async markNotificationAsRead(payload) {
const userToUpdate = new User(payload.user)
console.log(userToUpdate)
const index = userToUpdate.notifications.findIndex(
(n) => n.createdDate === payload.notification.createdDate,
)
@@ -80,9 +79,10 @@ export default class UserController extends Controller {
userData.notifications = userData.notifications.filter(
(notification) => notification.testId !== testId,
)
console.log('depois do filtro: ', userData.notifications)
// Atualizar o documento do usuário com as notificações filtradas
await super.update('users', userId, { notifications: userData.notifications })
await super.update('users', userId, {
notifications: userData.notifications,
})
}
} else {
console.log(`User document with ID ${userDocID} not found.`)
@@ -114,7 +114,6 @@ export default class UserController extends Controller {
delete userData.myAnswers[testIdToRemove]
}


await super.update('users', userId, userData)

console.log(`Test ${testIdToRemove} removed from user ${userId}'s data.`)
@@ -123,6 +122,4 @@ export default class UserController extends Controller {
throw error
}
}


}
72 changes: 37 additions & 35 deletions src/models/Notification.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,42 @@
/**
* Create a Notification.
* @param {string} title - The title value.
* @param {string} description - The description value.
*/
* Create a Notification.
* @param {string} title - The title value.
* @param {string} description - The description value.
*/

export default class Notification {
constructor({
title,
description,
redirectsTo,
author,
read,
testId,
} = {},
) {
this.title = title
this.description = description
this.redirectsTo = redirectsTo
this.createdDate = Date.now()
this.author = author
this.read = read
this.testId = testId
}
static toNotification(data) {
return new Notification(data)
}
constructor({
title,
description,
redirectsTo,
author,
read,
testId,
accessLevel,
} = {}) {
this.title = title
this.description = description
this.redirectsTo = redirectsTo
this.createdDate = Date.now()
this.author = author
this.read = read
this.testId = testId
this.accessLevel = accessLevel ?? null
}
static toNotification(data) {
return new Notification(data)
}

toFirestore() {
return {
title: this.title,
description: this.description,
redirectsTo: this.redirectsTo,
createdDate: this.createdDate,
author: this.author,
read: this.read,
testId: this.testId,
}
toFirestore() {
return {
title: this.title,
description: this.description,
redirectsTo: this.redirectsTo,
createdDate: this.createdDate,
author: this.author,
read: this.read,
testId: this.testId,
accessLevel: this.accessLevel,
}
}
}
}
1 change: 0 additions & 1 deletion src/utils/statistics.js
Original file line number Diff line number Diff line change
@@ -127,7 +127,6 @@ function statistics() {
ev.result = calcFinalResult(ev.heuristics)
})

console.log(resultEvaluator)
return resultEvaluator
}
}
1 change: 0 additions & 1 deletion src/views/admin/AnswerView.vue
Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@ export default {
return finalResult()
},
evaluatorStatistics() {
// console.log(this.sortedEvaluatorStatistics)
return this.$store.state.Answer.evaluatorStatistics
},
sortedEvaluatorStatistics() {
1 change: 0 additions & 1 deletion src/views/admin/CreateBlankView.vue
Original file line number Diff line number Diff line change
@@ -362,7 +362,6 @@ export default {
})
const testId = await this.$store.dispatch('createNewTest', test)
console.log(test)
this.sendManager(testId)
},
1 change: 0 additions & 1 deletion src/views/admin/CreateView.vue
Original file line number Diff line number Diff line change
@@ -119,7 +119,6 @@ export default {
})
const testId = await this.$store.dispatch('createNewTest', test)
console.log(test)
this.sendManager(testId)
},
3 changes: 1 addition & 2 deletions src/views/admin/DashboardView.vue
Original file line number Diff line number Diff line change
@@ -289,8 +289,7 @@ export default {
if (val == 1) await this.getSharedWithMeTests()
if (val == 2) await this.getPublicTests()
}
else if (this.mainIndex == 1) {
} else if (this.mainIndex == 1) {
if (val == 0) await this.getMyTemplates()
if (val == 1) await this.getPublicTemplates()
}
1 change: 0 additions & 1 deletion src/views/admin/EditTestView.vue
Original file line number Diff line number Diff line change
@@ -257,7 +257,6 @@ export default {
}
}
const auxT = Object.assign(this.test, this.object)
console.log(auxT)
this.$store.dispatch('updateTest', auxT)
},
21 changes: 14 additions & 7 deletions src/views/admin/ManagerView.vue
Original file line number Diff line number Diff line change
@@ -394,18 +394,23 @@ export default {
// Check if the user is a collaborator or owner
const isTestOwner = this.test.testAdmin?.userDocId === this.user.id
if (isTestOwner) return 0
const answers = []
const answersEntries = Object.entries(this.user.myAnswers)
answersEntries.forEach((a) => {
answers.push(a[1])
answersEntries.forEach((answer) => {
answers.push(answer[1])
})
const isCooperator = answers.find((a) => a.testDocId === this.test.id)
if (isCooperator) {
return isCooperator.accessLevel
if (this.test.cooperators) {
const coopsInfo = this.test.cooperators.find(
(coops) => coops.userDocId === this.user.id,
)
if (coopsInfo) {
return coopsInfo.accessLevel
}
}
if (this.test.isPublic) return 1
else return 2
}
return 1
},
},
@@ -474,11 +479,13 @@ export default {
(a) => a.testDocId === this.test.id,
)
if (!alreadyAccepted) {
console.log('Caiu como !alreadyAccepted')
// Get invitation
const invitation = this.test.cooperators.find(
(coop) => coop.token === this.token,
)
if (invitation) {
console.log('Caiu como invitation')
// User invited, and they have an account
if (this.user.email === invitation.email) {
// Accept Collaboration
4 changes: 2 additions & 2 deletions src/views/admin/ReportView.vue
Original file line number Diff line number Diff line change
@@ -164,7 +164,7 @@ export default {
return (
'Are you sure you want to delete ' +
(this.report !== null ? this.report.email : '') +
'\'s report? This action can\'t be undone'
"'s report? This action can't be undone"
)
},
answers() {
@@ -219,7 +219,6 @@ export default {
await updateDoc(answerDocRef, updateObject)
}
} catch (e) {
console.log(e)
this.$store.commit('setError', {
errorCode: `RemoveReportError`,
message: e,
@@ -262,6 +261,7 @@ export default {
},
getCooperatorEmail(userDocId) {
if (userDocId == this.user.id) return 'You'
let cooperatorEmail = null
if (this.test.cooperators && Array.isArray(this.test.cooperators)) {
for (const element of this.test.cooperators) {
8 changes: 0 additions & 8 deletions src/views/public/ModeratedTestView.vue
Original file line number Diff line number Diff line change
@@ -934,8 +934,6 @@ export default {
return this.$store.getters.remoteStream
},
isTestAvailable() {
console.log(new Date(this.testDate))
console.log(new Date() > new Date(this.testDate))
return new Date() > new Date(this.testDate)
},
},
@@ -951,7 +949,6 @@ export default {
},
async localStream(value) {
if (value && !this.isAdmin) {
console.log(value)
this.startRecordingEvaluator()
} else if (value && this.isAdmin) {
this.startRecordingModerator()
@@ -1051,7 +1048,6 @@ export default {
updateDoc(testRef, { testStructure })
.then(() => {
console.log('Status da tarefa atualizado com sucesso')
})
.catch((error) => {
console.error('Erro ao atualizar o status da tarefa:', error)
@@ -1086,7 +1082,6 @@ export default {
}
updateDoc(testRef, data)
.then(() => {
console.log(`Status da ${type} atualizado com sucesso`)
})
.catch((error) => {
console.error(`Erro ao atualizar o status da ${type}:`, error)
@@ -1134,14 +1129,12 @@ export default {
})
.then(() => {
this.calculateProgress()
console.log('Status atualizado com sucesso')
})
.catch((error) => {
console.error('Erro ao atualizar o status:', error)
})
},
async startRecordingEvaluator() {
console.log('startRecordingEvaluator')
this.recording = true
this.recordedChunksEvaluator = []
this.mediaRecorderEvaluator = new MediaRecorder(this.localStream)
@@ -1177,7 +1170,6 @@ export default {
},
async startRecordingModerator() {
console.log('startRecordingModerator')
this.recording = true
this.recordedChunksModerator = []
this.mediaRecorderModerator = new MediaRecorder(this.localStream)

0 comments on commit b63df13

Please sign in to comment.