Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 fix tutorial log when user is not able to perform a step #527

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/src/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ async def log_tutorial_feedback(
"confidence",
"confidence_level",
"tutorial_feedback",
"tutorial_option",
"selected_options",
"route_name",
]:
extras_logging["bg_" + key] = res[key]
Expand All @@ -158,7 +158,7 @@ async def log_identification_dummy(
"label",
"confidence",
"confidence_level",
"tutorial_option",
"selected_options",
]:
extras_logging["bg_" + key] = res[key]

Expand Down
49 changes: 11 additions & 38 deletions frontend/src/components/AskingExpert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,39 +20,39 @@ const imgUrl = computed(() => store.imgUrl);
const showModal = ref(false);

function onClose() {
store.tutorialFeedback = "";
tutorialFeedback.value = "";
showModal.value = false;
}

const tutorialFeedback = ref("");

async function sendTutorialFeedback() {
const feedback = {
image_url: imgUrl.value,
tutorial_feedback: store.tutorialFeedback,
tutorial_feedback: tutorialFeedback.value,
label: typology.value,
tutorial_option: store.currentOptionStep[store.currentStep] || null,
selected_options: store.selectedOptions,
route_name: route.name,
confidence: confidence.value,
confidence_level: confidenceLevel.value,
};
await axios
.post("/tutorial-feedback", feedback)
.then(async () => {
store.tutorialFeedback = feedback.tutorial_feedback;
.then(() => {
setMessage({
type: "success",
message: "Votre message a été pris en compte",
});
})
.catch(async (err) => {
import.meta.env.DEV && console.log(err);
.catch((error) => {
console.log(error);
setMessage({
type: "error",
message: "Une erreur a eu lieu en enregistrant de votre message.",
});
})
.finally(() =>
setTimeout(() => {
store.tutorialFeedback = "";
router.push({ name: "ResultPage" });
}, 3000),
);
Expand Down Expand Up @@ -80,20 +80,16 @@ async function sendTutorialFeedback() {
contenu de ce tutoriel en nous décrivant votre problème ci-dessous.
</p>
<DsfrInput
v-model="store.tutorialFeedback"
v-model="tutorialFeedback"
label="Décrivez votre problème"
label-visible
is-textarea
/>
</div>
<div>
<SnackbarAlert class="text-center pt-3" />
</div>
<div class="small-blank" />
<div class="modal-footer">
<DsfrButton
class="mt-5 w-100"
label="Valider et retour au résultat"
:disabled="!store.tutorialFeedback"
:disabled="tutorialFeedback === ''"
@click="sendTutorialFeedback()"
/>
</div>
Expand All @@ -105,27 +101,4 @@ async function sendTutorialFeedback() {
:deep(.fr-btn) span {
margin: auto !important;
}

.modal {
display: flex;
flex-direction: column;
}

.modal-content {
flex: 1;
overflow-y: auto;
}

.modal-footer {
position: sticky;
bottom: 0;
text-align: center;
background-color: #f5f5fe;
box-shadow: 0 -4px 16px rgb(0 0 0 / 25%);
padding: 1rem !important;
width: 100%;
}
.modal-footer button {
width: 100%;
}
</style>
3 changes: 0 additions & 3 deletions frontend/src/stores/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export const useStore = defineStore("result", {
const selectedOptions = ref([]);
const selectedAmmo = ref(undefined);
const selectedAlarmGun = ref(undefined);
const tutorialFeedback = ref("");
const isDummy = computed(() => !!(selectedAmmo.value === "billes"));
const isModalTransparentAmmoOpened = ref(null);

Expand All @@ -32,7 +31,6 @@ export const useStore = defineStore("result", {
selectedOptions.value = [];
selectedAmmo.value = undefined;
selectedAlarmGun.value = undefined;
tutorialFeedback.value = "";
isModalTransparentAmmoOpened.value = null;
}

Expand All @@ -48,7 +46,6 @@ export const useStore = defineStore("result", {
selectedOptions,
selectedAmmo,
selectedAlarmGun,
tutorialFeedback,
isDummy,
isModalTransparentAmmoOpened,
$reset,
Expand Down
Loading