Skip to content

Commit

Permalink
Refactor category handling
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashbrnrd committed May 28, 2024
1 parent a9564e0 commit 466425c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions frontend/src/components/ResultPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,31 @@ const confidence = computed(() => resultStore.confidence)
const confidenceLevel = computed(() => resultStore.confidenceLevel)
const img = computed(() => resultStore.img)
const typology = computed(() => resultStore.typology)
const typology = TYPOLOGIES[resultStore.typology]
const isDummy = computed(() => stepsStore.isDummy)
const isDummyTypology = computed(() => TYPOLOGIES[typology.value]?.isDummyTypology === true)
const isDummyTypology = computed(() => typology?.isDummyTypology === true)
const isCardDetected = computed(() => resultStore.gunLength !== null && resultStore.gunBarrelLength !== null)
const isUp = ref(false)
const isDown = ref(false)
const isFeedbackDone = ref(false)
const label = computed(() => TYPOLOGIES[typology.value]?.displayLabel)
const label = computed(() => typology?.displayLabel)
const category = computed(() => {
if (stepsStore.selectedAlarmGun && stepsStore.selectedAlarmGun !== '') {
return 'D'
} else if (isDummy.value) {
return 'Non Classée'
} else if (typology.value === 'revolver') {
return TYPOLOGIES[typology.value]?.categoryWithoutSecuring
} else if (typology.displayLabel === 'Revolver') {
return typology?.categoryWithoutSecuring
} else {
return TYPOLOGIES[typology.value]?.getCategory(resultStore.gunLength, resultStore.gunBarrelLength)
return typology?.getCategory(resultStore.gunLength, resultStore.gunBarrelLength)
}
})
const disclaimer = computed(() => TYPOLOGIES[typology.value] && Object.hasOwn(TYPOLOGIES[typology.value], 'getDisclaimer') ? TYPOLOGIES[typology.value].getDisclaimer(category.value, isCardDetected.value) : null)
const disclaimer = computed(() => typology && Object.hasOwn(typology, 'getDisclaimer') ? typology.getDisclaimer(category.value, isCardDetected.value) : null)
function sendFeedback (isCorrect: boolean) {
const json = {
Expand Down

0 comments on commit 466425c

Please sign in to comment.