Bài 18: Thu thập và phân loại dữ liệu

Thí sinh đọc kỹ đề trước khi làm bài
Cài đặt đề thi
Thời gian làm bài

Vui lòng cài đặt đề thi trước khi làm bài

Câu 1 Nhà bạn Mai mở tiệm kem, bạn ấy muốn tìm hiểu về các loại kem yêu thích của 30 khách hàng trong sáng chủ nhật và thu được kết quả như sau: Các loại kem được yêu thích
Từ bảng kiểm đếm của bạn Mai, em hãy cho biết Mai đang điều tra về vấn đề gì?
Câu 2 Lan tìm hiểu về thức ăn sáng nay của các bạn trong lớp và thu được kết quả như sau:
Dữ liệu nào sau đây không là số liệu?
Câu 3 Số học sinh vắng trong ngày của các lớp khối 6 trường THCS A là
Có bao nhiêu lớp có số học sinh vắng ít nhất
Câu 4 Một số con vật sống trên cạn: cá voi, chó, mèo, ngựa. Trong các dữ liệu trên, dữ liệu chưa hợp lí là:
Câu 5

Giá trị chưa hợp lí trong bảng dữ liệu là
Câu 6 Trong các dữ liệu sau, dữ liệu nào là dữ liệu định tính?
Câu 7 Lớp trưởng lớp 6A cần liệt kê số điểm của các học sinh lớp 6A, 6B để làm dự án học tập. Theo em, bạn ấy nên thu thập dữ liệu thống kê bằng cách nào.
Câu 8 Cho bảng thống kê về mức độ ảnh hưởng (đơn vị %) của các yếu tố đến chiều cao của trẻ:

Bạn Nam muốn chiều cao phát triển tốt nên quan tâm đến chế độ nào nhất?
Câu 9 Thu thập số liệu về 6 màu sắc yêu thích của học sinh lớp 1A được kết quả sau:
{ const questionType = question.getAttribute('data-type'); const correctStatus = question.getAttribute('data-correct'); if (questionType === 'WRITE_ANSWER' && correctStatus === 'false') { hasWriteAnswer = true; } }); if (hasWriteAnswer) { openPopupComponent(dataContent.js_2) document.getElementById('check_ex_all').style.display = "none"; document.getElementById('check_ex_final').style.display = "inline-flex"; } else { btnBefore.style.display = 'none'; btnAfter.style.display = 'flex'; setTimeout(() => { this.remove(); result_exam_card.style.display = "flex"; mainSection.scrollIntoView({ behavior: 'smooth' }); appendExamInfoCard(countok, countselect, time_user, totalPoints); }, 3000); toastr.success(dataContent.js_3); postAjaxData(countok, countselect, time_user, totalPoints); } } }); document.getElementById('check_ex_final').addEventListener('click', function () { const btnBefore = document.querySelector('.btn-js-final-before'); const btnAfter = document.querySelector('.btn-js-final-after'); const mainSection = document.querySelector('main'); let result_exam_card = document.querySelector('.exam-information-detail'); const questions = document.querySelectorAll('.question-js'); const results = []; const timeString = document.getElementById('countdown-timer').textContent; const timeParts = timeString.split(':'); let time_max = 90 * document.querySelectorAll('.question-js').length; const hours = parseInt(timeParts[0], 10); const minutes = parseInt(timeParts[1], 10); const seconds = parseInt(timeParts[2], 10); const time_left = (hours * 3600) + (minutes * 60) + seconds; const time_user = time_max - time_left; let anyUnanswered = scroll_and_check_fill_answer(questions); let { countselect } = check_num_ok(questions); let totalPoints = parseFloat(document.querySelector('.js-final-score').innerText); let countok = parseInt(document.querySelector('.js-true-result-btn').innerText); btnBefore.style.display = 'none'; btnAfter.style.display = 'flex'; setTimeout(() => { this.remove(); result_exam_card.style.display = "flex"; mainSection.scrollIntoView({ behavior: 'smooth' }); appendExamInfoCard(countok, countselect, time_user, totalPoints); }, 3000); toastr.success(dataContent.js_3); postAjaxData(countok, countselect, time_user, totalPoints); }); }); var type_subject_ = `toan`; var type_class_ = `lop-8`; var type_lesson_ = ``; function postAjaxData(countok, countselect, time_user, totalPoints) { const now = new Date().toLocaleString(); const name_data = `Bài 18: Thu thập và phân loại dữ liệu`; const id_update = `6778110571fd3a72375dd0dc`; const textOf = el => el ? (el.textContent || el.innerText || '').trim() : ''; // ----- build câu hỏi đơn ----- function buildSingleQuestionObject(qEl) { const obj = {}; obj.type = (qEl.getAttribute('data-type') || '').toString(); const qid = qEl.getAttribute('data-quesid') || qEl.getAttribute('data-id') || null; if (qid) obj._id = qid; const title = qEl.querySelector('.question-title p strong') || qEl.querySelector('.question-title p') || qEl.querySelector('.question-title'); obj.name = title ? textOf(title) : (qEl.getAttribute('data-name') || ''); obj.note = qEl.getAttribute('data-note') || ''; obj.source = qEl.getAttribute('data-source') || ''; obj.status = qEl.getAttribute('data-status') || (qEl.getAttribute('data-correct') === 'true' ? 'true' : 'good'); obj.type_subject = qEl.getAttribute('data-su') || qEl.getAttribute('data-type_subject') || `toan`; obj.type_class = qEl.getAttribute('data-cls') || qEl.getAttribute('data-type_class') || `lop-8`; obj.type_lesson = qEl.getAttribute('data-le') || qEl.getAttribute('data-type_lesson') || ``; obj.ques_id = qEl.getAttribute('data-question') || qEl.getAttribute('data-question-sp') || ''; obj.user_tick = { type: qEl.getAttribute('data-correct') === 'true' ? 'True' : 'false' }; // ---- SINGLE_ANSWER ---- if (obj.type === 'SINGLE_ANSWER') { const inputs = Array.from(qEl.querySelectorAll('input[type="radio"]')); obj.answers = inputs.map(inp => { const label = inp.closest('label') || inp.parentNode; const name = textOf(label); const note = inp.getAttribute('data-note') || ''; const a = { name, note: note === 'null' ? '' : note }; if (inp.checked) a.u_ans = "true"; return a; }); const correctInputs = Array.from(qEl.querySelectorAll('input[data-corect]')).filter(i => (i.dataset.corect || '').toLowerCase().includes('ok')); if (correctInputs.length) { obj.correctAnswer = correctInputs.map(i => { const lab = i.closest('label') || i.parentNode; return textOf(lab); }).join('; '); } } // ---- MULTY_ANSWER ---- else if (obj.type === 'MULTY_ANSWER') { const answers = []; const container = qEl.querySelector('.answers'); if (container) { const children = Array.from(container.children); for (let i = 0; i < children.length; i++) { const ch = children[i]; if (ch.classList && ch.classList.contains('answer-option')) { const nameText = textOf(ch); const next = children[i + 1]; const answerObj = { name: nameText, note: '' }; if (next) { const radios = Array.from(next.querySelectorAll('input[type="radio"], input[type="checkbox"]')); const checked = radios.find(r => r.checked); if (checked) { answerObj.u_ans = checked.dataset.cheack === 'true' ? 'true' : 'false'; } } answers.push(answerObj); } } } if (!answers.length) { const inps = Array.from(qEl.querySelectorAll('input[type="radio"], input[type="checkbox"]')); answers.push(...inps.map(i => { const lab = i.closest('label') || i.parentNode; const nm = textOf(lab); const a = { name: nm, note: i.getAttribute('data-note') || '' }; if (i.checked) a.u_ans = "true"; return a; })); } if (answers.length) obj.answers = answers; const corrects = Array.from(qEl.querySelectorAll('input[data-result]')).filter(i => (i.dataset.result || '').toLowerCase().includes('ok')); if (corrects.length) { obj.correctAnswer = Array.from(new Set(corrects.map(i => { const lab = i.closest('label') || i.parentNode; return textOf(lab); }))).join('; '); } } // ---- WRITE_ANSWER ---- else if (obj.type === 'WRITE_ANSWER') { const inp = qEl.querySelector('input[type="text"], textarea'); if (inp) { obj.u_ans = (inp.value || '').toString(); if (inp.dataset && inp.dataset.corect) obj.correctAnswer = inp.dataset.corect; } else obj.u_ans = ''; } return obj; } // ----- build QUES_MIX_ANSWER ----- function buildMixQuestionObject(parent) { const parentObj = {}; parentObj.type = 'QUES_MIX_ANSWER'; parentObj._id = parent.getAttribute('data-quesid') || parent.getAttribute('data-id') || ''; parentObj.name = textOf(parent.querySelector('.question-title')) || parent.getAttribute('data-name') || ''; parentObj.note = parent.getAttribute('data-note') || ''; parentObj.source = parent.getAttribute('data-source') || parentObj.name; parentObj.status = parent.getAttribute('data-status') || (parent.getAttribute('data-correct') === 'true' ? 'true' : 'false'); parentObj.user_tick = { type: parentObj.status === 'true' ? 'True' : 'false' }; parentObj.type_subject = parent.getAttribute('data-su') || `toan`; parentObj.type_class = parent.getAttribute('data-cls') || `lop-8`; parentObj.type_lesson = parent.getAttribute('data-le') || ``; parentObj.type_book = parent.getAttribute('data-book') || null; parentObj.type_chapter = parent.getAttribute('data-chapter') || null; // ---- duyệt các question con ---- const subs = Array.from(parent.querySelectorAll('.question.question-js')); parentObj.quests_more = subs.map(s => { const sub = buildSingleQuestionObject(s); return { name: sub.name, note: sub.note, type: sub.type, source: sub.source, ques_id: sub.ques_id || '', status: sub.status || '', answers: sub.answers || [], correctAnswer: sub.correctAnswer || '', user_tick: sub.user_tick || { type: 'false' }, ...(typeof sub.u_ans !== 'undefined' ? { u_ans: sub.u_ans } : {}) }; }); return parentObj; } // ----- gom tất cả câu hỏi ----- const ques_test = []; // 1. Lấy tất cả mix parent const mixParents = Array.from(document.querySelectorAll('[data-type="QUES_MIX_ANSWER"]')); mixParents.forEach(p => ques_test.push(buildMixQuestionObject(p))); // 2. Lấy các câu hỏi đơn lẻ (không thuộc mix) const allQuestionJs = Array.from(document.querySelectorAll('.question-js')); const standalone = allQuestionJs.filter(q => !q.closest('[data-type="QUES_MIX_ANSWER"]')); standalone.forEach(q => ques_test.push(buildSingleQuestionObject(q))); console.log('[postAjaxData] built ques_test =', ques_test); // ----- payload ----- const payload = { ques_test, name_data, id_update, time_now: now, correct_answers: countok, total_select: countselect, total_questions: parseInt(`12`) || ques_test.length, score: totalPoints, time_max: 90 * (document.querySelectorAll('.question-js').length || ques_test.length), time_user }; console.log('[postAjaxData] payload ready', payload); // ----- gửi AJAX ----- const xhr = new XMLHttpRequest(); xhr.open('POST', '/api_history_test_p2', true); xhr.setRequestHeader('Content-Type', 'application/json'); xhr.onreadystatechange = function () { if (xhr.readyState === 4) { if (xhr.status === 200) { console.log('Gửi dữ liệu thành công!'); } else { console.error('Lỗi gửi dữ liệu: ' + xhr.status, xhr.responseText); } } }; xhr.send(JSON.stringify(payload)); } //b1 check if everything is filled out and highlight the title in red if the answer is not filled in (returns true or false) function scroll_and_check_fill_answer(questions) { let anyUnanswered = false; questions.forEach(question => { const questionType = question.getAttribute('data-type'); let isUnanswered = false; if (questionType === 'MULTY_ANSWER') { const selectedAnswers = question.querySelectorAll('input[type="radio"]:checked'); if (selectedAnswers.length === 0) { isUnanswered = true; } } else if (questionType === 'SINGLE_ANSWER') { const selectedAnswer = question.querySelector('input[type="radio"]:checked'); if (!selectedAnswer) { isUnanswered = true; } } else if (questionType === 'WRITE_ANSWER') { const userAnswer = question.querySelector('input[type="text"]').value.trim(); if (userAnswer === "") { isUnanswered = true; } } if (isUnanswered) { anyUnanswered = true; const questionTitle = question.querySelector('.question-title'); if (questionTitle) { questionTitle.style.color = 'red'; } question.setAttribute("data-correct", "false"); question.scrollIntoView({ behavior: 'smooth', block: 'center' }); return true; } }); return anyUnanswered; } //b2 check num ok and ok corect function check_num_ok(questions) { let countok = 0; let countselect = 0; let totalPoints = 0; const count_query = parseInt(`12`); const allSingleAnswer = Array.from(questions).every(question => question.getAttribute('data-type') === 'SINGLE_ANSWER'); let maxPoint = 0; questions.forEach(question => { const questionType = question.getAttribute('data-type'); if (questionType === 'SINGLE_ANSWER') { const selectedAnswer = question.querySelector('input[type="radio"]:checked'); const isCorrect = selectedAnswer ? selectedAnswer.dataset.corect === 'ok' : false; if (selectedAnswer) { countselect++; } if (isCorrect) { countok++; totalPoints += 0.25; } maxPoint += 0.25; } else if (questionType === 'MULTY_ANSWER') { countselect++; const selectedAnswers = question.querySelectorAll('input[type="radio"]:checked'); let correctCount = 0; selectedAnswers.forEach(answer => { if ((answer.dataset.result === 'ok' && answer.dataset.cheack === 'true') || (answer.dataset.result === 'none' && answer.dataset.cheack === 'false')) { correctCount++; } }); if (correctCount > 0) { countok++; } if (correctCount === 1) { totalPoints += 0.1; } else if (correctCount === 2) { totalPoints += 0.25; } else if (correctCount === 3) { totalPoints += 0.5; } else if (correctCount === 4) { totalPoints += 1; } maxPoint += 1; } else if (questionType === 'WRITE_ANSWER') { const userAnswer = question.querySelector('input[type="text"]').value.trim(); const correctAnswer = question.querySelector('input[type="text"]').dataset.corect; if (userAnswer !== "") { countselect++; } let slug_ = `toan`; if (userAnswer === correctAnswer) { countok++; if (slug_.includes("toan")) { totalPoints += 0.5; maxPoint += 0.5; } else { totalPoints += 0.25; maxPoint += 0.25; } } else { if (slug_.includes("toan")) { maxPoint += 0.5; } else { maxPoint += 0.25; } } } }); if (allSingleAnswer) { totalPoints = (countok / count_query) * 10; maxPoint = 10; } else { totalPoints = (totalPoints / maxPoint) * 10; maxPoint = 10; } totalPoints = parseFloat(totalPoints.toFixed(2)); maxPoint = parseFloat(maxPoint.toFixed(2)); return { countok, countselect, totalPoints, maxPoint }; } // b3 selech no ok to red function check_num_red_color(questions) { questions.forEach(question => { const questionType = question.getAttribute('data-type'); if (questionType === 'MULTY_ANSWER') { const selectedAnswers = question.querySelectorAll('input[type="radio"]:checked'); let allCorrect = true; selectedAnswers.forEach(answer => { const answerResult = answer.dataset.result; const isTrueSelected = answer.dataset.cheack; if ((answerResult === 'ok' && isTrueSelected === "true") || (answerResult === 'none' && isTrueSelected === "false")) { answer.parentNode.style.color = ''; answer.parentNode.style.fontWeight = 'bold'; } else { answer.parentNode.style.color = 'red'; answer.parentNode.style.fontWeight = 'bold'; allCorrect = false; } }); if (allCorrect && selectedAnswers.length > 0) { question.setAttribute("data-correct", "true"); } else { question.setAttribute("data-correct", "false"); } } else if (questionType === 'SINGLE_ANSWER') { const selectedAnswer = question.querySelector('input[type="radio"]:checked'); const selectedAnswerCorrect = selectedAnswer ? selectedAnswer.dataset.corect : null; if (selectedAnswer) { if (!selectedAnswerCorrect.includes('ok')) { selectedAnswer.parentNode.style.color = 'red'; selectedAnswer.parentNode.style.fontWeight = 'bold'; question.setAttribute("data-correct", "false"); } else { selectedAnswer.parentNode.style.fontWeight = 'bold'; question.setAttribute("data-correct", "true"); } } } else if (questionType === 'WRITE_ANSWER') { const userAnswer = question.querySelector('input[type="text"]').value; const correctAnswer = question.querySelector('input[type="text"]').dataset.corect; const answer_ques_js = question.querySelector('.answer_ques-js'); if (userAnswer === correctAnswer) { question.querySelector('input[type="text"]').style.color = 'green'; question.setAttribute("data-correct", "true"); } else { question.querySelector('input[type="text"]').style.color = 'red'; question.setAttribute("data-correct", "false"); answer_ques_js.style.display = 'block'; answer_ques_js.style.color = 'red'; } } }); // Cập nhật trạng thái cho các câu hỏi document.querySelectorAll('.question-js').forEach(function (question) { const questionId = question.getAttribute('data-question'); const correct = question.getAttribute('data-correct'); const listItem = document.querySelector(`.js-list-item-menu[data-buttonby="${questionId}"]`); if (listItem) { if (correct === "true") { listItem.classList.add('true'); } else if (correct === "false") { listItem.classList.add('false'); } } }); } // b4 This code displays the answer as well as the hrml option to redo, view the answer, and do another problem function views_return_html(countok, countselect, totalPoints, maxPoint) { var count_ = countselect; var count_query = countselect; let num_false = count_query - countok; var num_point = count_ - num_false; let returnMaxPoint = 10; // gen more html var temporaryHTML = `
Bạn đã trả lời đúng ${countok} trên tổng số ${count_query} câu
Số điểm bạn nhận được là ${totalPoints}
Làm lại lần nữa
hiển thị kết quả
Làm đề khác
`; // document.getElementById('questions').style.display = "none"; document.getElementById('questions_sp').style.display = "block"; document.getElementById('questions_sp').innerHTML = temporaryHTML var doExAgainElement = document.getElementById('do_ex_again'); if (doExAgainElement) { doExAgainElement.addEventListener('click', function () { window.location.reload(); }); } document.getElementById('questions_sp').style.display = "none"; const questions = document.querySelectorAll('.question'); check_num_red_color(questions); set_green_option_ok(); // document.getElementById('check_ex_all').style.display = "none"; document.querySelector('.js-example-detail-timer').style.display = 'none'; document.querySelector('.js-example-detail-result').style.display = 'block'; document.querySelector('.js-final-score').textContent = `${totalPoints} / ${returnMaxPoint}`; if (num_point < count_ / 2) { document.querySelector('.js-final-score').classList.add('color-red') } else { document.querySelector('.js-final-score').classList.add('color-green') } document.querySelector('.js-true-result-btn').textContent = countok; document.querySelector('.js-false-result-btn').textContent = num_false; document.querySelectorAll('.answer_ques-js').forEach(element => { element.style.display = 'block'; }); var detailedAnswerElement = document.getElementById('detailed_answer'); if (detailedAnswerElement) { detailedAnswerElement.addEventListener('click', function () { document.getElementById('questions_sp').style.display = "none"; document.getElementById('questions').style.display = "block"; const questions = document.querySelectorAll('.question'); check_num_red_color(questions); set_green_option_ok(); // document.getElementById('check_ex_all').style.display = "none"; }); } // add event ID 'more_ex_test' var moreExTestElement = document.getElementById('more_ex_test'); var type_subject = `toan` var type_class = `lop-8` //'type_subject': 1, 'type_class': 1 if (moreExTestElement) { moreExTestElement.addEventListener('click', function () { // get now domain var currentDomain = window.location.origin; window.location.href = `${currentDomain}/?su=${type_subject}&class=${type_class}`; }); } }; // b4.1 convert all select ok color green/block answer function set_green_option_ok() { // Xử lý cho câu hỏi dạng SINGLE_ANSWER và MULTY_ANSWER const radioAndCheckboxButtons = document.querySelectorAll('input[type="radio"], input[type="checkbox"]'); radioAndCheckboxButtons.forEach(input => { const corectValue = input.getAttribute('data-corect'); if (corectValue && corectValue.includes('ok')) { input.parentNode.style.color = 'green'; // Đánh dấu đáp án đúng màu xanh input.parentNode.style.fontWeight = 'bold'; } }); // Xử lý cho câu hỏi dạng WRITE_ANSWER const textInputs = document.querySelectorAll('input[type="text"]'); textInputs.forEach(input => { const correctAnswer = input.getAttribute('data-corect'); if (correctAnswer && input.value.trim() === correctAnswer) { input.style.color = 'green'; // Đánh dấu đáp án đúng màu xanh cho câu trả lời tự luận input.style.fontWeight = 'bold'; } }); } // document.addEventListener('DOMContentLoaded', function () { const answerOptions = document.querySelectorAll('.answer-option-single'); answerOptions.forEach(option => { const input = option.querySelector('input[type="radio"]'); input.addEventListener('change', function () { const allOptions = this.closest('.answers').querySelectorAll('.answer-option-single'); allOptions.forEach(opt => opt.classList.remove('selected')); if (this.checked) { option.classList.add('selected'); } }); }); }); function startTimer(secs) { function tick() { if (secs > 0) { secs--; } else { clearInterval(ticker); openPopupComponent(dataContent.js_4); setTimeout(function () { //views_return_html(countok); document.querySelector('#check_ex_all').click(); }, 2000); } let hours = Math.floor(secs / 3600); let mins = Math.floor((secs % 3600) / 60); let remainingSecs = secs % 60; let pretty = `${(hours < 10 ? '0' : '')}${hours}:${(mins < 10 ? '0' : '')}${mins}:${(remainingSecs < 10 ? '0' : '')}${remainingSecs}`; document.getElementById("countdown-timer").innerHTML = pretty; } tick(); let ticker = setInterval(tick, 1000); } document.addEventListener('DOMContentLoaded', function () { let secsCalc = 90 * document.querySelectorAll('.question-js').length; let minuteCalc = secsCalc / 60; let valTimeInput = document.querySelector('.js-time-radios-value'); valTimeInput.setAttribute('value', minuteCalc) valTimeInput.setAttribute('max', minuteCalc) document.querySelector('.js-button-do-exam').addEventListener('click', function () { if (document.querySelector('#NonExamTime').checked) { document.querySelector("#countdown-timer").innerHTML = 'Không tính giờ'; document.querySelector('.js-exam-setting').style.display = 'none'; document.querySelector('.js-exam-detail').style.display = 'flex'; } else if (document.querySelector('#ExamTime').checked) { var time_t = 60 * document.querySelector('#t_time_s').value; startTimer(time_t); //startTimer(secsCalc); document.querySelector('.js-exam-setting').style.display = 'none'; document.querySelector('.js-exam-detail').style.display = 'flex'; } document.querySelector('.js-check-start-example').classList.add("active"); document.querySelector('.js-btn-modal').style.display = 'inline-flex'; document.querySelectorAll('.feedback-button-js').forEach((items) => { items.style.display = "inline-flex" }) }); document.querySelectorAll('.js-question-detail').forEach(function (element) { element.addEventListener('change', function () { let questionBlock = this.closest('.question'); if (questionBlock) { let questionType = questionBlock.getAttribute('data-type'); let questionId = questionBlock.getAttribute('data-question'); let listItemMenu = document.querySelector('.js-list-item-menu[data-buttonby="' + questionId + '"]'); if (listItemMenu && !listItemMenu.classList.contains('answered')) { listItemMenu.classList.add('answered'); questionBlock.setAttribute('data-act', 1); } if (questionType === 'SINGLE_ANSWER') { let answerOptions = Array.from(questionBlock.querySelectorAll('input[name="' + this.name + '"]')); let selectedIndex = answerOptions.indexOf(this); let selectedLetter = String.fromCharCode(65 + selectedIndex); let getInputQuestion = listItemMenu.nextElementSibling; if (getInputQuestion) { getInputQuestion.textContent = selectedLetter; } } else { let getInputQuestion = listItemMenu.nextElementSibling; if (getInputQuestion) { getInputQuestion.textContent = 'X'; } } } }); }); // Click event for list item menu $(".js-list-item-menu").click(function () { let dataButtonBy = $(this).attr("data-buttonby"); let questionElement = $( '.question-js[data-question="' + dataButtonBy + '"]' ); if (questionElement.length) { $("html, body").animate( { scrollTop: questionElement.offset().top - 100, }, 200 ); } }); document.querySelector('.show-list-question-js').addEventListener('click', function () { this.classList.toggle("active"); }) }); document.addEventListener('DOMContentLoaded', () => { const paragraphs = document.querySelectorAll('.question-title p'); paragraphs.forEach(paragraph => { if (paragraph.innerText.trim() === ':') { paragraph.remove(); } }); }); function appendExamInfoCard(countok, countselect, time_user, totalPoints) { let percent = (countok / countselect) * 100; let lever; let comment; if (percent < 50) { lever = 1; comment = dataContent.js_5; } else if (percent >= 50 && percent < 75) { lever = 2; comment = dataContent.js_5; } else { lever = 3; comment = dataContent.js_5; } function formatTime(seconds) { const hours = Math.floor(seconds / 3600); const minutes = Math.floor((seconds % 3600) / 60); const remainingSeconds = seconds % 60; const formattedTime = String(hours).padStart(2, '0') + ':' + String(minutes).padStart(2, '0') + ':' + String(remainingSeconds).padStart(2, '0'); return formattedTime; } const formattedTime = formatTime(time_user); let content_7 = dataContent.js_7; let content_8 = dataContent.js_8; let content_9 = dataContent.js_9; let content_10 = dataContent.js_10; let content_11 = dataContent.js_11; const cardBodyHtml = `

Kết quả chi tiết

  • ${content_7} ${totalPoints} / 10
  • ${content_8} ${formattedTime}

${content_9}

${content_10}${countok} / ${countselect}
${content_11}
${percent.toFixed(2)}%
${comment}
`; const examInfoDetail = document.querySelector('.exam-information-detail'); examInfoDetail.insertAdjacentHTML('beforeend', cardBodyHtml); } function openPopupComponent(text) { $('.js-popup-text').text(text); // Mở popup $.fancybox.open({ src: '#modal-popup', type: 'inline', opts: { clickSlide: false, clickOutside: true, keyboard: false, touch: { vertical: false, momentum: false }, buttons: [], afterLoad: function (instance, current) { $('.fancybox-close-small').show(); } } }); }