fix [P-237]: окончание для минут

This commit is contained in:
Denis Voinovich committed 2025-06-02 10:58:09 +03:00
1 parent e4f7a53bce
commit 06e80baff8
1 file changed
+16 -3
@@ -12,7 +12,7 @@
{{ data?.description }} {{ data?.description }}
</p> </p>
<p v-if="!isDialog"> <p v-if="!isDialog">
<strong>Время на прохождение — {{ data?.time }} минут</strong> <strong>Время на прохождение — {{ data?.time }} {{ timeWordDeclension }}</strong>
</p> </p>
</v-card-text> </v-card-text>
<v-card-actions v-if="!isDialog" class="mx-2 my-4"> <v-card-actions v-if="!isDialog" class="mx-2 my-4">
@@ -43,12 +43,25 @@ export default {
default: false default: false
} }
}, },
setup() { setup(props) {
const route = useRoute(); const route = useRoute();
const isExamMode = computed(() => route.query.mode === 'exam'); const isExamMode = computed(() => route.query.mode === 'exam');
const timeWordDeclension = computed(() => {
if (!props.data?.time) return 'минут';
const lastDigit = props.data.time % 10;
const lastTwoDigits = props.data.time % 100;
if (lastTwoDigits >= 11 && lastTwoDigits <= 14) return 'минут';
if (lastDigit === 1) return 'минута';
if (lastDigit >= 2 && lastDigit <= 4) return 'минуты';
return 'минут';
});
return { return {
isExamMode isExamMode,
timeWordDeclension
}; };
} }
}; };