selector.addClass("active")
this.instantReviewAnimationTimeout = setTimeout(function (e) {
$this.stopInstantReviewAnimation()
- }, 400000)
+ }, 4000)
},
stopInstantReviewAnimation: function () {
confirmTheMatch: function () {
let lastIndex = this.swiperTop.slides.length - 1
- let index = this.swiperBottom.activeIndex
+ let index = parseInt($(this.swiperBottom.slides[this.swiperBottom.activeIndex]).attr('data-prop'));
this.quiz.screens.currentQuestionAnswers.push(index)
- this.swiperBottomEl.find(".swiper-slide").get(index).remove()
+ this.swiperBottomEl.find(".swiper-slide[data-prop='" + index + "']").remove()
this.swiperBottom.update()
if (this.swiperTop.activeIndex === lastIndex) {
checkQuestion: function (questionIndex) {
let question = this.quiz.data.questions[questionIndex];
- let a = [];
let ok = 'ok';
let count = question.count_for_score;
let log = {
}
ok = this_score >= min_score ? 'ok' : 'nok';
- log.answer = a;
+ log.answer = userAnswers;
} else if (question.type === 'draganddrop') {
min_score = this.getMinScore(question);
this_score = 0;
}
ok = this_score >= min_score ? 'ok' : 'nok';
- log.answer = a;
+ log.answer = userAnswers;
+ } else if (question.type === 'match') {
+ min_score = this.getMinScore(question);
+ this_score = 0;
+ for (let k in userAnswers) {
+ if (parseInt(k) === parseInt(userAnswers[k])) {
+ this_score++;
+ }
+ }
+ ok = this_score >= min_score ? 'ok' : 'nok';
+ log.answer = userAnswers;
} else {
log.answer = $(this).find('input,textarea,select').val();
}
@php
- $propositions = array_map(function($n) { return $n['proposition']; }, $question['answers']);
- $additional_prop = array_map(function($n) { return $n['content']; }, $question['additional_proposition']);
- $propositions = [...$additional_prop,...$propositions];
+ $propositions=[];
+ foreach ($question['answers'] as $k=>$a) {
+ $propositions[]=['n'=>$k,'p'=>$a['proposition']];
+ }
+ $k++;
+ foreach ($question['additional_proposition'] as $j=>$additional_prop) {
+ $propositions[]=['n'=>$k+$j,'p'=>$additional_prop['content']];
+ }
shuffle($propositions);
@endphp
<div class="swiper-container bottom-slider">
<div class="swiper-wrapper">
@foreach($propositions as $prop)
- <div class="swiper-slide">
- {{ $prop }}
+ <div class="swiper-slide" data-prop="{{$prop['n']}}">
+ {{ $prop['p'] }}
</div>
@endforeach
</div>