| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | /******/ (() => { // webpackBootstrap |
| 2 | 2 | /******/ var __webpack_modules__ = ({ |
| 3 | 3 | |
| 4 | 4 | /***/ "./assets/src/apps/js/frontend/quiz/components/attempts/index.js" |
| @@ -23,10 +23,10 @@ | ||
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | |
| 26 | 26 | |
| 27 | -/** | |
| 28 | - * Displays list of all attempt from a quiz. | |
| 27 | +/** | |
| 28 | + * Displays list of all attempt from a quiz. | |
| 29 | 29 | */ |
| 30 | 30 | const Attempts = () => { |
| 31 | 31 | const attempts = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('learnpress/quiz').getData('attempts') || []; |
| 32 | 32 | const hasAttempts = attempts && !!attempts.length; |
| @@ -45,14 +45,14 @@ | ||
| 45 | 45 | }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Passing grade', 'learnpress')), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("th", { |
| 46 | 46 | className: "quiz-attempts__result" |
| 47 | 47 | }, (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Result', 'learnpress')))), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("tbody", null, attempts.map((row, key) => { |
| 48 | 48 | // Re-write value to attempts.timeSpend |
| 49 | - /*if ( lpQuizSettings.checkNorequizenroll === 1 ) { | |
| 50 | - const timespendStart = window.localStorage.getItem( 'quiz_start_' + lpQuizSettings.id ), | |
| 51 | - timespendEnd = window.localStorage.getItem( 'quiz_end_' + lpQuizSettings.id ); | |
| 52 | - if ( timespendStart && timespendEnd ) { | |
| 53 | - row.timeSpend = timeDifference( timespendStart, timespendEnd ).duration; | |
| 54 | - } | |
| 49 | + /*if ( lpQuizSettings.checkNorequizenroll === 1 ) { | |
| 50 | + const timespendStart = window.localStorage.getItem( 'quiz_start_' + lpQuizSettings.id ), | |
| 51 | + timespendEnd = window.localStorage.getItem( 'quiz_end_' + lpQuizSettings.id ); | |
| 52 | + if ( timespendStart && timespendEnd ) { | |
| 53 | + row.timeSpend = timeDifference( timespendStart, timespendEnd ).duration; | |
| 54 | + } | |
| 55 | 55 | }*/ |
| 56 | 56 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("tr", { |
| 57 | 57 | key: `attempt-${key}` |
| 58 | 58 | }, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("td", { |
| @@ -257,10 +257,10 @@ | ||
| 257 | 257 | |
| 258 | 258 | |
| 259 | 259 | |
| 260 | 260 | class ButtonHint extends _wordpress_element__WEBPACK_IMPORTED_MODULE_1__.Component { |
| 261 | - /** | |
| 262 | - * Callback to show hint of question | |
| 261 | + /** | |
| 262 | + * Callback to show hint of question | |
| 263 | 263 | */ |
| 264 | 264 | showHint = () => { |
| 265 | 265 | const { |
| 266 | 266 | showHint, |
| @@ -342,20 +342,20 @@ | ||
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | // No require enroll |
| 346 | - /*if ( lpQuizSettings.checkNorequizenroll === 1 ) { | |
| 347 | - // Reset data | |
| 348 | - window.localStorage.removeItem( 'quiz_start_' + lpQuizSettings.id ); | |
| 349 | - window.localStorage.removeItem( 'quiz_userdata_' + lpQuizSettings.id ); | |
| 350 | - window.localStorage.setItem( 'quiz_start_' + lpQuizSettings.id, Date.now() ); | |
| 351 | - // Set retake to local.storage | |
| 352 | - const retakenNumber = window.localStorage.getItem( 'quiz_retake_' + lpQuizSettings.id ); | |
| 353 | - if ( retakenNumber >= 1 ) { | |
| 354 | - window.localStorage.setItem( 'quiz_retake_' + lpQuizSettings.id, parseInt( retakenNumber ) + 1 ); | |
| 355 | - } else { | |
| 356 | - window.localStorage.setItem( 'quiz_retake_' + lpQuizSettings.id, 1 ); | |
| 357 | - } | |
| 346 | + /*if ( lpQuizSettings.checkNorequizenroll === 1 ) { | |
| 347 | + // Reset data | |
| 348 | + window.localStorage.removeItem( 'quiz_start_' + lpQuizSettings.id ); | |
| 349 | + window.localStorage.removeItem( 'quiz_userdata_' + lpQuizSettings.id ); | |
| 350 | + window.localStorage.setItem( 'quiz_start_' + lpQuizSettings.id, Date.now() ); | |
| 351 | + // Set retake to local.storage | |
| 352 | + const retakenNumber = window.localStorage.getItem( 'quiz_retake_' + lpQuizSettings.id ); | |
| 353 | + if ( retakenNumber >= 1 ) { | |
| 354 | + window.localStorage.setItem( 'quiz_retake_' + lpQuizSettings.id, parseInt( retakenNumber ) + 1 ); | |
| 355 | + } else { | |
| 356 | + window.localStorage.setItem( 'quiz_retake_' + lpQuizSettings.id, 1 ); | |
| 357 | + } | |
| 358 | 358 | }*/ |
| 359 | 359 | |
| 360 | 360 | startQuiz(); |
| 361 | 361 | }; |
| @@ -563,12 +563,12 @@ | ||
| 563 | 563 | }, this.props.message)); |
| 564 | 564 | } |
| 565 | 565 | } |
| 566 | 566 | |
| 567 | -/** | |
| 568 | - * Helper function to check a button should be show or not. | |
| 569 | - * | |
| 570 | - * Buttons [hint, check] | |
| 567 | +/** | |
| 568 | + * Helper function to check a button should be show or not. | |
| 569 | + * | |
| 570 | + * Buttons [hint, check] | |
| 571 | 571 | */ |
| 572 | 572 | const MaybeShowButton = (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_3__.compose)((0,_wordpress_data__WEBPACK_IMPORTED_MODULE_2__.withSelect)(select => { |
| 573 | 573 | const { |
| 574 | 574 | getData |
| @@ -705,13 +705,13 @@ | ||
| 705 | 705 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 706 | 706 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); |
| 707 | 707 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__); |
| 708 | 708 | |
| 709 | -/** | |
| 710 | - * Quiz Content. | |
| 711 | - * Edit: Use React hook. | |
| 712 | - * | |
| 713 | - * @author nhamdv - ThimPress | |
| 709 | +/** | |
| 710 | + * Quiz Content. | |
| 711 | + * Edit: Use React hook. | |
| 712 | + * | |
| 713 | + * @author nhamdv - ThimPress | |
| 714 | 714 | */ |
| 715 | 715 | |
| 716 | 716 | const Content = () => { |
| 717 | 717 | const content = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_1__.select)('learnpress/quiz').getData('content'); |
| @@ -815,13 +815,13 @@ | ||
| 815 | 815 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 816 | 816 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); |
| 817 | 817 | /* harmony import */ var _duration__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../duration */ "./assets/src/apps/js/frontend/quiz/components/duration/index.js"); |
| 818 | 818 | |
| 819 | -/** | |
| 820 | - * Quiz Meta. | |
| 821 | - * Edit: Use React Hook. | |
| 822 | - * | |
| 823 | - * @author Nhamdv - ThimPress | |
| 819 | +/** | |
| 820 | + * Quiz Meta. | |
| 821 | + * Edit: Use React Hook. | |
| 822 | + * | |
| 823 | + * @author Nhamdv - ThimPress | |
| 824 | 824 | */ |
| 825 | 825 | |
| 826 | 826 | |
| 827 | 827 | |
| @@ -1214,10 +1214,16 @@ | ||
| 1214 | 1214 | question, |
| 1215 | 1215 | isShow, |
| 1216 | 1216 | isShowIndex, |
| 1217 | 1217 | isShowHint, |
| 1218 | - status | |
| 1218 | + status, | |
| 1219 | + results | |
| 1219 | 1220 | } = this.props; |
| 1221 | + if (results && results.questions && results.questions[question.id]) { | |
| 1222 | + if (typeof results.questions[question.id].correct !== 'undefined') { | |
| 1223 | + question.correct = results.questions[question.id].correct; | |
| 1224 | + } | |
| 1225 | + } | |
| 1220 | 1226 | const QuestionTypes = LP.questionTypes.default; |
| 1221 | 1227 | const editPermalink = this.getEditLink(); |
| 1222 | 1228 | if (editPermalink) { |
| 1223 | 1229 | jQuery('#wp-admin-bar-edit-lp_question').find('.ab-item').attr('href', editPermalink); |
| @@ -1332,9 +1338,10 @@ | ||
| 1332 | 1338 | answered: getQuestionAnswered(id), |
| 1333 | 1339 | questionsRendered: getData('questionsRendered'), |
| 1334 | 1340 | editPermalink: getData('editPermalink'), |
| 1335 | 1341 | numPages: getData('numPages'), |
| 1336 | - mark: getQuestionMark(id) || '' | |
| 1342 | + mark: getQuestionMark(id) || '', | |
| 1343 | + results: getData('results') | |
| 1337 | 1344 | }; |
| 1338 | 1345 | }), (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_2__.withDispatch)(dispatch => { |
| 1339 | 1346 | const { |
| 1340 | 1347 | updateUserQuestionAnswers, |
| @@ -1370,13 +1377,13 @@ | ||
| 1370 | 1377 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 1371 | 1378 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_3__); |
| 1372 | 1379 | /* harmony import */ var _single_curriculum_components_items_progress__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../single-curriculum/components/items-progress */ "./assets/src/apps/js/frontend/single-curriculum/components/items-progress.js"); |
| 1373 | 1380 | |
| 1374 | -/** | |
| 1375 | - * Quizz Result. | |
| 1376 | - * Edit: Use React hook. | |
| 1377 | - * | |
| 1378 | - * @author Nhamdv - ThimPress | |
| 1381 | +/** | |
| 1382 | + * Quizz Result. | |
| 1383 | + * Edit: Use React hook. | |
| 1384 | + * | |
| 1385 | + * @author Nhamdv - ThimPress | |
| 1379 | 1386 | */ |
| 1380 | 1387 | |
| 1381 | 1388 | |
| 1382 | 1389 | |
| @@ -1480,11 +1487,11 @@ | ||
| 1480 | 1487 | }); |
| 1481 | 1488 | }, results.result > 0 ? 1000 : 10)(); |
| 1482 | 1489 | }; |
| 1483 | 1490 | |
| 1484 | - /** | |
| 1485 | - * Render HTML elements. | |
| 1486 | - * | |
| 1491 | + /** | |
| 1492 | + * Render HTML elements. | |
| 1493 | + * | |
| 1487 | 1494 | */ |
| 1488 | 1495 | |
| 1489 | 1496 | let percentResult = percentage; |
| 1490 | 1497 | if (!Number.isInteger(percentage)) { |
| @@ -1658,11 +1665,11 @@ | ||
| 1658 | 1665 | const $qs = $pc.find('.quiz-status'); |
| 1659 | 1666 | const pcTop = $qs.offset().top - 92; |
| 1660 | 1667 | let isFixed = false; |
| 1661 | 1668 | |
| 1662 | - /** | |
| 1663 | - * Check when status bar is stopped in the top | |
| 1664 | - * to add new class into html | |
| 1669 | + /** | |
| 1670 | + * Check when status bar is stopped in the top | |
| 1671 | + * to add new class into html | |
| 1665 | 1672 | */ |
| 1666 | 1673 | $sc.on('scroll', () => { |
| 1667 | 1674 | if ($sc.scrollTop() >= pcTop) { |
| 1668 | 1675 | if (isFixed) { |
| @@ -1682,10 +1689,10 @@ | ||
| 1682 | 1689 | } |
| 1683 | 1690 | }); |
| 1684 | 1691 | }, []); |
| 1685 | 1692 | |
| 1686 | - /** | |
| 1687 | - * Submit question to record results. | |
| 1693 | + /** | |
| 1694 | + * Submit question to record results. | |
| 1688 | 1695 | */ |
| 1689 | 1696 | const submit = () => { |
| 1690 | 1697 | const { |
| 1691 | 1698 | confirm |
| @@ -1766,12 +1773,12 @@ | ||
| 1766 | 1773 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__); |
| 1767 | 1774 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data"); |
| 1768 | 1775 | /* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__); |
| 1769 | 1776 | |
| 1770 | -/** | |
| 1771 | - * Edit: React hook. | |
| 1772 | - * | |
| 1773 | - * @author Nhamdv - ThimPress | |
| 1777 | +/** | |
| 1778 | + * Edit: React hook. | |
| 1779 | + * | |
| 1780 | + * @author Nhamdv - ThimPress | |
| 1774 | 1781 | */ |
| 1775 | 1782 | |
| 1776 | 1783 | |
| 1777 | 1784 | const Timer = () => { |
| @@ -2018,13 +2025,13 @@ | ||
| 2018 | 2025 | const { |
| 2019 | 2026 | camelCaseDashObjectKeys, |
| 2020 | 2027 | Hook |
| 2021 | 2028 | } = LP; |
| 2022 | -/** | |
| 2023 | - * Set user data for app. | |
| 2024 | - * | |
| 2025 | - * @param key | |
| 2026 | - * @param data | |
| 2029 | +/** | |
| 2030 | + * Set user data for app. | |
| 2031 | + * | |
| 2032 | + * @param key | |
| 2033 | + * @param data | |
| 2027 | 2034 | */ |
| 2028 | 2035 | function setQuizData(key, data) { |
| 2029 | 2036 | if (typeof key === 'string') { |
| 2030 | 2037 | data = { |
| @@ -2038,12 +2045,12 @@ | ||
| 2038 | 2045 | data: camelCaseDashObjectKeys(data) |
| 2039 | 2046 | }; |
| 2040 | 2047 | } |
| 2041 | 2048 | |
| 2042 | -/** | |
| 2043 | - * Set question will display. | |
| 2044 | - * | |
| 2045 | - * @param questionId | |
| 2049 | +/** | |
| 2050 | + * Set question will display. | |
| 2051 | + * | |
| 2052 | + * @param questionId | |
| 2046 | 2053 | */ |
| 2047 | 2054 | function setCurrentQuestion(questionId) { |
| 2048 | 2055 | return { |
| 2049 | 2056 | type: 'SET_CURRENT_QUESTION', |
| @@ -2071,10 +2078,10 @@ | ||
| 2071 | 2078 | results |
| 2072 | 2079 | }; |
| 2073 | 2080 | } |
| 2074 | 2081 | |
| 2075 | -/** | |
| 2076 | - * Request to api for starting a quiz. | |
| 2082 | +/** | |
| 2083 | + * Request to api for starting a quiz. | |
| 2077 | 2084 | */ |
| 2078 | 2085 | const startQuiz = function* () { |
| 2079 | 2086 | const { |
| 2080 | 2087 | itemId, |
| @@ -2231,19 +2238,19 @@ | ||
| 2231 | 2238 | answers |
| 2232 | 2239 | }; |
| 2233 | 2240 | } |
| 2234 | 2241 | |
| 2235 | -/** | |
| 2236 | - * Handle when user change value on input fill in blanks. | |
| 2237 | - * | |
| 2238 | - * @param questionId | |
| 2239 | - * @param idInput | |
| 2240 | - * @param valueInput | |
| 2241 | - * @param quizId | |
| 2242 | - * @param courseId | |
| 2243 | - * @param userId | |
| 2244 | - * @since 4.2.5.9 | |
| 2245 | - * @version 1.0.0 | |
| 2242 | +/** | |
| 2243 | + * Handle when user change value on input fill in blanks. | |
| 2244 | + * | |
| 2245 | + * @param questionId | |
| 2246 | + * @param idInput | |
| 2247 | + * @param valueInput | |
| 2248 | + * @param quizId | |
| 2249 | + * @param courseId | |
| 2250 | + * @param userId | |
| 2251 | + * @since 4.2.5.9 | |
| 2252 | + * @version 1.0.0 | |
| 2246 | 2253 | */ |
| 2247 | 2254 | function updateUserQuestionFibAnswers(questionId, idInput, valueInput, quizId, courseId = 0, userId = 0) { |
| 2248 | 2255 | return { |
| 2249 | 2256 | type: 'UPDATE_USER_QUESTION_FIB_ANSWERS', |
| @@ -2390,15 +2397,15 @@ | ||
| 2390 | 2397 | /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) |
| 2391 | 2398 | /* harmony export */ }); |
| 2392 | 2399 | /* harmony import */ var refx__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! refx */ "./node_modules/refx/refx.js"); |
| 2393 | 2400 | /* harmony import */ var refx__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(refx__WEBPACK_IMPORTED_MODULE_0__); |
| 2394 | -/** | |
| 2395 | - * External dependencies | |
| 2401 | +/** | |
| 2402 | + * External dependencies | |
| 2396 | 2403 | */ |
| 2397 | 2404 | |
| 2398 | 2405 | |
| 2399 | -/** | |
| 2400 | - * Internal dependencies | |
| 2406 | +/** | |
| 2407 | + * Internal dependencies | |
| 2401 | 2408 | */ |
| 2402 | 2409 | //import effects from './effects'; |
| 2403 | 2410 | |
| 2404 | 2411 | const effects = { |
| @@ -2412,14 +2419,14 @@ | ||
| 2412 | 2419 | }; |
| 2413 | 2420 | } |
| 2414 | 2421 | }; |
| 2415 | 2422 | |
| 2416 | -/** | |
| 2417 | - * Applies the custom middlewares used specifically in the editor module. | |
| 2418 | - * | |
| 2419 | - * @param {Object} store Store Object. | |
| 2420 | - * | |
| 2421 | - * @return {Object} Update Store Object. | |
| 2423 | +/** | |
| 2424 | + * Applies the custom middlewares used specifically in the editor module. | |
| 2425 | + * | |
| 2426 | + * @param {Object} store Store Object. | |
| 2427 | + * | |
| 2428 | + * @return {Object} Update Store Object. | |
| 2422 | 2429 | */ |
| 2423 | 2430 | function applyMiddlewares(store) { |
| 2424 | 2431 | let enhancedDispatch = () => { |
| 2425 | 2432 | throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.'); |
| @@ -2768,13 +2775,13 @@ | ||
| 2768 | 2775 | return options; |
| 2769 | 2776 | }; |
| 2770 | 2777 | |
| 2771 | 2778 | |
| 2772 | -/** | |
| 2773 | - * Get current status of an item in course. | |
| 2774 | - * | |
| 2775 | - * @param state | |
| 2776 | - * @param itemId | |
| 2779 | +/** | |
| 2780 | + * Get current status of an item in course. | |
| 2781 | + * | |
| 2782 | + * @param state | |
| 2783 | + * @param itemId | |
| 2777 | 2784 | */ |
| 2778 | 2785 | function getItemStatus(state, itemId) { |
| 2779 | 2786 | const item = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.select)('course-learner/user').getItemById(itemId); |
| 2780 | 2787 | return item ? get(item, 'userSettings.status') : ''; |
| @@ -2782,14 +2789,14 @@ | ||
| 2782 | 2789 | function getProp(state, prop, defaultValue) { |
| 2783 | 2790 | return state[prop] || defaultValue; |
| 2784 | 2791 | } |
| 2785 | 2792 | |
| 2786 | -/** | |
| 2787 | - * Get quiz attempted. | |
| 2788 | - * | |
| 2789 | - * @param state | |
| 2790 | - * @param itemId | |
| 2791 | - * @return {Array} | |
| 2793 | +/** | |
| 2794 | + * Get quiz attempted. | |
| 2795 | + * | |
| 2796 | + * @param state | |
| 2797 | + * @param itemId | |
| 2798 | + * @return {Array} | |
| 2792 | 2799 | */ |
| 2793 | 2800 | function getQuizAttempts(state, itemId) { |
| 2794 | 2801 | const item = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.select)('course-learner/user').getItemById(itemId); |
| 2795 | 2802 | return item ? get(item, 'userSettings.attempts') : []; |
| @@ -2794,14 +2801,14 @@ | ||
| 2794 | 2801 | const item = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.select)('course-learner/user').getItemById(itemId); |
| 2795 | 2802 | return item ? get(item, 'userSettings.attempts') : []; |
| 2796 | 2803 | } |
| 2797 | 2804 | |
| 2798 | -/** | |
| 2799 | - * Get answers for a quiz user has did. | |
| 2800 | - * | |
| 2801 | - * @param state | |
| 2802 | - * @param itemId | |
| 2803 | - * @return {{}} | |
| 2805 | +/** | |
| 2806 | + * Get answers for a quiz user has did. | |
| 2807 | + * | |
| 2808 | + * @param state | |
| 2809 | + * @param itemId | |
| 2810 | + * @return {{}} | |
| 2804 | 2811 | */ |
| 2805 | 2812 | function getQuizAnswered(state, itemId) { |
| 2806 | 2813 | const item = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.select)('course-learner/user').getItemById(itemId); |
| 2807 | 2814 | return item ? get(item, 'userSettings.answered', {}) : {}; |
| @@ -2806,13 +2813,13 @@ | ||
| 2806 | 2813 | const item = (0,_wordpress_data__WEBPACK_IMPORTED_MODULE_0__.select)('course-learner/user').getItemById(itemId); |
| 2807 | 2814 | return item ? get(item, 'userSettings.answered', {}) : {}; |
| 2808 | 2815 | } |
| 2809 | 2816 | |
| 2810 | -/** | |
| 2811 | - * Get all questions in quiz. | |
| 2812 | - * | |
| 2813 | - * @param state | |
| 2814 | - * @return {*} | |
| 2817 | +/** | |
| 2818 | + * Get all questions in quiz. | |
| 2819 | + * | |
| 2820 | + * @param state | |
| 2821 | + * @return {*} | |
| 2815 | 2822 | */ |
| 2816 | 2823 | function getQuestions(state) { |
| 2817 | 2824 | const { |
| 2818 | 2825 | userQuiz |
| @@ -2820,14 +2827,14 @@ | ||
| 2820 | 2827 | const questions = get(userQuiz, 'questions'); |
| 2821 | 2828 | return questions ? Object.values(questions) : []; |
| 2822 | 2829 | } |
| 2823 | 2830 | |
| 2824 | -/** | |
| 2825 | - * Get property of store data. | |
| 2826 | - * | |
| 2827 | - * @param state - Store data | |
| 2828 | - * @param prop - Optional. NULL will return all data. | |
| 2829 | - * @return {*} | |
| 2831 | +/** | |
| 2832 | + * Get property of store data. | |
| 2833 | + * | |
| 2834 | + * @param state - Store data | |
| 2835 | + * @param prop - Optional. NULL will return all data. | |
| 2836 | + * @return {*} | |
| 2830 | 2837 | */ |
| 2831 | 2838 | function getData(state, prop) { |
| 2832 | 2839 | const { |
| 2833 | 2840 | userQuiz |
| @@ -2858,14 +2865,14 @@ | ||
| 2858 | 2865 | } = state; |
| 2859 | 2866 | return get(userQuiz, `answered.${id}.mark`) || undefined; |
| 2860 | 2867 | } |
| 2861 | 2868 | |
| 2862 | -/** | |
| 2863 | - * Get current question is doing. | |
| 2864 | - * | |
| 2865 | - * @param {Object} state | |
| 2866 | - * @param {string} ret | |
| 2867 | - * @return {*} | |
| 2869 | +/** | |
| 2870 | + * Get current question is doing. | |
| 2871 | + * | |
| 2872 | + * @param {Object} state | |
| 2873 | + * @param {string} ret | |
| 2874 | + * @return {*} | |
| 2868 | 2875 | */ |
| 2869 | 2876 | function getCurrentQuestion(state, ret = '') { |
| 2870 | 2877 | const questionsPerPage = get(state, 'userQuiz.questionsPerPage') || 1; |
| 2871 | 2878 | if (questionsPerPage > 1) { |
| @@ -2874,13 +2881,13 @@ | ||
| 2874 | 2881 | const currentPage = get(state, 'userQuiz.currentPage') || 1; |
| 2875 | 2882 | return ret === 'object' ? get(state, `userQuiz.questions[${currentPage - 1}]`) : get(state, `userQuiz.questionIds[${currentPage - 1}]`); |
| 2876 | 2883 | } |
| 2877 | 2884 | |
| 2878 | -/** | |
| 2879 | - * Return a question contains fully data with title, content, ... | |
| 2880 | - * | |
| 2881 | - * @param state | |
| 2882 | - * @param theId | |
| 2885 | +/** | |
| 2886 | + * Return a question contains fully data with title, content, ... | |
| 2887 | + * | |
| 2888 | + * @param state | |
| 2889 | + * @param theId | |
| 2883 | 2890 | */ |
| 2884 | 2891 | const getQuestion = function getQuestion(state, theId) { |
| 2885 | 2892 | const { |
| 2886 | 2893 | userQuiz |
| @@ -2892,14 +2899,14 @@ | ||
| 2892 | 2899 | }); |
| 2893 | 2900 | }; |
| 2894 | 2901 | |
| 2895 | 2902 | |
| 2896 | -/** | |
| 2897 | - * If user has used 'Instant check' for a question. | |
| 2898 | - * | |
| 2899 | - * @param {Object} state - Global state for app. | |
| 2900 | - * @param {number} id | |
| 2901 | - * @return {boolean} | |
| 2903 | +/** | |
| 2904 | + * If user has used 'Instant check' for a question. | |
| 2905 | + * | |
| 2906 | + * @param {Object} state - Global state for app. | |
| 2907 | + * @param {number} id | |
| 2908 | + * @return {boolean} | |
| 2902 | 2909 | */ |
| 2903 | 2910 | function isCheckedAnswer(state, id) { |
| 2904 | 2911 | const checkedQuestions = get(state, 'userQuiz.checkedQuestions') || []; |
| 2905 | 2912 | return checkedQuestions.indexOf(id) !== -1; |
| @@ -2905,15 +2912,15 @@ | ||
| 2905 | 2912 | return checkedQuestions.indexOf(id) !== -1; |
| 2906 | 2913 | } |
| 2907 | 2914 | function isCorrect(state, id) {} |
| 2908 | 2915 | |
| 2909 | -/** | |
| 2910 | - * Get questions user has selected answers. | |
| 2911 | - * | |
| 2912 | - * @param {Object} state. Global app state | |
| 2913 | - * @param state | |
| 2914 | - * @param {number} questionId | |
| 2915 | - * @return {{}} | |
| 2916 | +/** | |
| 2917 | + * Get questions user has selected answers. | |
| 2918 | + * | |
| 2919 | + * @param {Object} state. Global app state | |
| 2920 | + * @param state | |
| 2921 | + * @param {number} questionId | |
| 2922 | + * @return {{}} | |
| 2916 | 2923 | */ |
| 2917 | 2924 | const getQuestionsSelectedAnswers = function (state, questionId) { |
| 2918 | 2925 | const data = get(state, 'userQuiz.answered'); |
| 2919 | 2926 | const returnData = {}; |
| @@ -2934,14 +2941,14 @@ | ||
| 2934 | 2941 | return returnData; |
| 2935 | 2942 | }; |
| 2936 | 2943 | |
| 2937 | 2944 | |
| 2938 | -/** | |
| 2939 | - * Get mark user earned. | |
| 2940 | - * Just for questions user has used 'Instant check' button. | |
| 2941 | - * | |
| 2942 | - * @param state | |
| 2943 | - * @return {number} | |
| 2945 | +/** | |
| 2946 | + * Get mark user earned. | |
| 2947 | + * Just for questions user has used 'Instant check' button. | |
| 2948 | + * | |
| 2949 | + * @param state | |
| 2950 | + * @return {number} | |
| 2944 | 2951 | */ |
| 2945 | 2952 | function getUserMark(state) { |
| 2946 | 2953 | const userQuiz = state.userQuiz || {}; |
| 2947 | 2954 | const { |
| @@ -3045,12 +3052,12 @@ | ||
| 3045 | 3052 | !*** ./assets/src/apps/js/frontend/single-curriculum/components/compatible.js ***! |
| 3046 | 3053 | \********************************************************************************/ |
| 3047 | 3054 | () { |
| 3048 | 3055 | |
| 3049 | -/** | |
| 3050 | - * Compatible with Page Builder. | |
| 3051 | - * | |
| 3052 | - * @author nhamdv | |
| 3056 | +/** | |
| 3057 | + * Compatible with Page Builder. | |
| 3058 | + * | |
| 3059 | + * @author nhamdv | |
| 3053 | 3060 | */ |
| 3054 | 3061 | |
| 3055 | 3062 | LP.Hook.addAction('lp-compatible-builder', () => { |
| 3056 | 3063 | LP.Hook.removeAction('lp-compatible-builder'); |
| @@ -3060,12 +3067,12 @@ | ||
| 3060 | 3067 | window.dispatchEvent(new Event('resize')); |
| 3061 | 3068 | }); |
| 3062 | 3069 | } |
| 3063 | 3070 | |
| 3064 | - /*if ( typeof vc_js !== 'undefined' && typeof VcWaypoint !== 'undefined' ) { | |
| 3065 | - [ ...document.querySelectorAll( '#popup-content' ) ][ 0 ].addEventListener( 'scroll', () => { | |
| 3066 | - VcWaypoint.refreshAll(); | |
| 3067 | - } ); | |
| 3071 | + /*if ( typeof vc_js !== 'undefined' && typeof VcWaypoint !== 'undefined' ) { | |
| 3072 | + [ ...document.querySelectorAll( '#popup-content' ) ][ 0 ].addEventListener( 'scroll', () => { | |
| 3073 | + VcWaypoint.refreshAll(); | |
| 3074 | + } ); | |
| 3068 | 3075 | }*/ |
| 3069 | 3076 | }); |
| 3070 | 3077 | LP.Hook.addAction('lp-quiz-compatible-builder', () => { |
| 3071 | 3078 | LP.Hook.removeAction('lp-quiz-compatible-builder'); |
| @@ -3465,19 +3472,19 @@ | ||
| 3465 | 3472 | |
| 3466 | 3473 | /******/ }); |
| 3467 | 3474 | /************************************************************************/ |
| 3468 | 3475 | /******/ // The module cache |
| 3469 | -/******/ var __webpack_module_cache__ = {}; | |
| 3476 | +/******/ const __webpack_module_cache__ = {}; | |
| 3470 | 3477 | /******/ |
| 3471 | 3478 | /******/ // The require function |
| 3472 | 3479 | /******/ function __webpack_require__(moduleId) { |
| 3473 | 3480 | /******/ // Check if module is in cache |
| 3474 | -/******/ var cachedModule = __webpack_module_cache__[moduleId]; | |
| 3481 | +/******/ const cachedModule = __webpack_module_cache__[moduleId]; | |
| 3475 | 3482 | /******/ if (cachedModule !== undefined) { |
| 3476 | 3483 | /******/ return cachedModule.exports; |
| 3477 | 3484 | /******/ } |
| 3478 | 3485 | /******/ // Create a new module (and put it into the cache) |
| 3479 | -/******/ var module = __webpack_module_cache__[moduleId] = { | |
| 3486 | +/******/ const module = __webpack_module_cache__[moduleId] = { | |
| 3480 | 3487 | /******/ // no module.id needed |
| 3481 | 3488 | /******/ // no module.loaded needed |
| 3482 | 3489 | /******/ exports: {} |
| 3483 | 3490 | /******/ }; |
| @@ -3484,9 +3491,9 @@ | ||
| 3484 | 3491 | /******/ |
| 3485 | 3492 | /******/ // Execute the module function |
| 3486 | 3493 | /******/ if (!(moduleId in __webpack_modules__)) { |
| 3487 | 3494 | /******/ delete __webpack_module_cache__[moduleId]; |
| 3488 | -/******/ var e = new Error("Cannot find module '" + moduleId + "'"); | |
| 3495 | +/******/ const e = new Error("Cannot find module '" + moduleId + "'"); | |
| 3489 | 3496 | /******/ e.code = 'MODULE_NOT_FOUND'; |
| 3490 | 3497 | /******/ throw e; |
| 3491 | 3498 | /******/ } |
| 3492 | 3499 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); |
| @@ -3499,9 +3506,9 @@ | ||
| 3499 | 3506 | /******/ /* webpack/runtime/compat get default export */ |
| 3500 | 3507 | /******/ (() => { |
| 3501 | 3508 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
| 3502 | 3509 | /******/ __webpack_require__.n = (module) => { |
| 3503 | -/******/ var getter = module && module.__esModule ? | |
| 3510 | +/******/ const getter = module && module.__esModule ? | |
| 3504 | 3511 | /******/ () => (module['default']) : |
| 3505 | 3512 | /******/ () => (module); |
| 3506 | 3513 | /******/ __webpack_require__.d(getter, { a: getter }); |
| 3507 | 3514 | /******/ return getter; |
| @@ -3509,14 +3516,29 @@ | ||
| 3509 | 3516 | /******/ })(); |
| 3510 | 3517 | /******/ |
| 3511 | 3518 | /******/ /* webpack/runtime/define property getters */ |
| 3512 | 3519 | /******/ (() => { |
| 3513 | -/******/ // define getter functions for harmony exports | |
| 3520 | +/******/ // define getter/value functions for harmony exports | |
| 3514 | 3521 | /******/ __webpack_require__.d = (exports, definition) => { |
| 3515 | -/******/ for(var key in definition) { | |
| 3516 | -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 3517 | -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 3522 | +/******/ if(Array.isArray(definition)) { | |
| 3523 | +/******/ var i = 0; | |
| 3524 | +/******/ while(i < definition.length) { | |
| 3525 | +/******/ var key = definition[i++]; | |
| 3526 | +/******/ var binding = definition[i++]; | |
| 3527 | +/******/ if(!__webpack_require__.o(exports, key)) { | |
| 3528 | +/******/ if(binding === 0) { | |
| 3529 | +/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] }); | |
| 3530 | +/******/ } else { | |
| 3531 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding }); | |
| 3532 | +/******/ } | |
| 3533 | +/******/ } else if(binding === 0) { i++; } | |
| 3518 | 3534 | /******/ } |
| 3535 | +/******/ } else { | |
| 3536 | +/******/ for(var key in definition) { | |
| 3537 | +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { | |
| 3538 | +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); | |
| 3539 | +/******/ } | |
| 3540 | +/******/ } | |
| 3519 | 3541 | /******/ } |
| 3520 | 3542 | /******/ }; |
| 3521 | 3543 | /******/ })(); |
| 3522 | 3544 | /******/ |
| @@ -3521,9 +3543,9 @@ | ||
| 3521 | 3543 | /******/ })(); |
| 3522 | 3544 | /******/ |
| 3523 | 3545 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 3524 | 3546 | /******/ (() => { |
| 3525 | -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) | |
| 3547 | +/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop)) | |
| 3526 | 3548 | /******/ })(); |
| 3527 | 3549 | /******/ |
| 3528 | 3550 | /******/ /* webpack/runtime/make namespace object */ |
| 3529 | 3551 | /******/ (() => { |
| @@ -3528,9 +3550,9 @@ | ||
| 3528 | 3550 | /******/ /* webpack/runtime/make namespace object */ |
| 3529 | 3551 | /******/ (() => { |
| 3530 | 3552 | /******/ // define __esModule on exports |
| 3531 | 3553 | /******/ __webpack_require__.r = (exports) => { |
| 3532 | -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { | |
| 3554 | +/******/ if(Symbol.toStringTag) { | |
| 3533 | 3555 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 3534 | 3556 | /******/ } |
| 3535 | 3557 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 3536 | 3558 | /******/ }; |
| @@ -3536,9 +3558,9 @@ | ||
| 3536 | 3558 | /******/ }; |
| 3537 | 3559 | /******/ })(); |
| 3538 | 3560 | /******/ |
| 3539 | 3561 | /************************************************************************/ |
| 3540 | -var __webpack_exports__ = {}; | |
| 3562 | +let __webpack_exports__ = {}; | |
| 3541 | 3563 | // This entry needs to be wrapped in an IIFE because it needs to be in strict mode. |
| 3542 | 3564 | (() => { |
| 3543 | 3565 | "use strict"; |
| 3544 | 3566 | /*!*********************************************!*\ |