diff --git a/assets/core/scss/components/_modal.scss b/assets/core/scss/components/_modal.scss
index e60937b624..128a8cdccb 100644
--- a/assets/core/scss/components/_modal.scss
+++ b/assets/core/scss/components/_modal.scss
@@ -107,6 +107,17 @@
padding: $tutor-spacing-5 $tutor-spacing-7;
border-top: 1px solid $tutor-border-idle;
}
+
+ &-confirmation-actions {
+ display: flex;
+ flex-wrap: wrap;
+
+ > * {
+ flex: 1 1 calc(50% - #{$tutor-spacing-4 * 0.5});
+ max-width: 100%;
+ white-space: nowrap;
+ }
+ }
}
@include tutor-breakpoint-down(md) {
diff --git a/assets/src/js/v3/entries/course-builder/components/curriculum/NegativeMarkTypeMismatchNotice.tsx b/assets/src/js/v3/entries/course-builder/components/curriculum/NegativeMarkTypeMismatchNotice.tsx
index 863c7ec6e3..e4ab412253 100644
--- a/assets/src/js/v3/entries/course-builder/components/curriculum/NegativeMarkTypeMismatchNotice.tsx
+++ b/assets/src/js/v3/entries/course-builder/components/curriculum/NegativeMarkTypeMismatchNotice.tsx
@@ -29,13 +29,13 @@ const NegativeMarkTypeMismatchModalContent = ({
const descriptionHtml = isSwitchingToPoints
? sprintf(
// translators: 1: current penalty percentage (e.g. 15%), 2: new penalty placeholder ({new penalty})
- __('The penalty per wrong answer will change from %1$s to %2$s points.', 'tutor'),
+ __('The penalty per question will change from %1$s to %2$s points.', 'tutor'),
`${currentPenalty}%`,
adminNegativeMarkValue,
)
: sprintf(
// translators: 1: current penalty points (e.g. 15), 2: new penalty placeholder ({new penalty})
- __('The penalty per wrong answer will change from %1$s points to %2$s%%.', 'tutor'),
+ __('The penalty per question will change from %1$s points to %2$s%%.', 'tutor'),
currentPenalty,
adminNegativeMarkValue,
);
@@ -80,15 +80,12 @@ const NegativeMarkTypeMismatchNotice = () => {
const mismatchNoticeText = isSwitchingToPoints
? sprintf(
// translators: %s is the current percentage penalty, e.g. 15
- __('The default penalty unit is now points. This quiz still uses a %s%% penalty per wrong answer.', 'tutor'),
+ __('The default penalty unit is now points. This quiz still uses a %s%% penalty per question.', 'tutor'),
negativeMarkValue ?? 0,
)
: sprintf(
// translators: %s is the current points penalty, e.g. 15
- __(
- 'The default penalty unit is now percentage. This quiz still uses a %s pts penalty per wrong answer.',
- 'tutor',
- ),
+ __('The default penalty unit is now percentage. This quiz still uses a %s pts penalty per question.', 'tutor'),
negativeMarkValue ?? 0,
);
diff --git a/assets/src/js/v3/entries/course-builder/components/modals/AssignmentModal.tsx b/assets/src/js/v3/entries/course-builder/components/modals/AssignmentModal.tsx
index 9107e7094e..933588ccce 100644
--- a/assets/src/js/v3/entries/course-builder/components/modals/AssignmentModal.tsx
+++ b/assets/src/js/v3/entries/course-builder/components/modals/AssignmentModal.tsx
@@ -513,7 +513,10 @@ const AssignmentModal = ({
{...controllerProps}
type="number"
label={__('Maximum Resubmission Attempts', 'tutor')}
- helpText={__('Set how many times students can resubmit even after the deadline.', 'tutor')}
+ helpText={__(
+ 'Set the resubmission limit. Failed learners can retry even after the deadline.',
+ 'tutor',
+ )}
selectOnFocus
/>
)}
diff --git a/assets/src/scss/frontend/components/_quiz-attempt-details.scss b/assets/src/scss/frontend/components/_quiz-attempt-details.scss
index 87cfbdb022..82d9e52693 100644
--- a/assets/src/scss/frontend/components/_quiz-attempt-details.scss
+++ b/assets/src/scss/frontend/components/_quiz-attempt-details.scss
@@ -304,9 +304,16 @@
overflow: hidden;
&:has(.tutor-quiz-review-item-title) {
- @include tutor-flex(column, flex-start, center);
+ @include tutor-flex(column, flex-start, flex-start);
gap: $tutor-spacing-none;
+
+ .tutor-quiz-review-item-text {
+ @include tutor-flex(row, center);
+
+ flex: 1;
+ width: 100%;
+ }
}
.tutor-quiz-review-item-title {
diff --git a/assets/src/scss/frontend/components/_quiz-attempts.scss b/assets/src/scss/frontend/components/_quiz-attempts.scss
index 089a1e0377..8df3fa4e31 100644
--- a/assets/src/scss/frontend/components/_quiz-attempts.scss
+++ b/assets/src/scss/frontend/components/_quiz-attempts.scss
@@ -220,6 +220,7 @@
gap: $tutor-spacing-1;
.tutor-quiz-marks-correct,
+ .tutor-quiz-marks-partial,
.tutor-quiz-marks-incorrect {
@include tutor-badge-base();
diff --git a/assets/src/scss/frontend/dashboard/_billing.scss b/assets/src/scss/frontend/dashboard/_billing.scss
index 6234287a89..ea315fffe1 100644
--- a/assets/src/scss/frontend/dashboard/_billing.scss
+++ b/assets/src/scss/frontend/dashboard/_billing.scss
@@ -159,6 +159,11 @@
gap: $tutor-spacing-4;
color: $tutor-text-secondary;
+
+ @include tutor-breakpoint-down(sm) {
+ flex-wrap: wrap;
+ row-gap: $tutor-spacing-2;
+ }
}
&-id {
@@ -173,13 +178,14 @@
&-payment-method {
@include tutor-breakpoint-down(sm) {
- .tutor-badge {
+ .tutor-badge:has(img, svg) {
font-size: 0;
line-height: 0;
gap: 0;
padding: $tutor-spacing-2;
- img {
+ img,
+ svg {
display: block;
}
}
diff --git a/classes/Quiz.php b/classes/Quiz.php
index a66973e45b..82a8650d90 100644
--- a/classes/Quiz.php
+++ b/classes/Quiz.php
@@ -2807,7 +2807,7 @@ public static function render_quiz_actions( $quiz_id ) {
->id( $retry_modal_id )
->title( __( 'Retry Quiz?', 'tutor' ) )
->icon( tutor_utils()->get_themed_svg( 'images/illustrations/quiz-retry.svg' ), 80, 80, ConfirmationModal::ICON_TYPE_HTML )
- ->message( __( 'Retrying this quiz will reset your current attempt. Your answers and score from this attempt will be lost.', 'tutor' ) )
+ ->message( __( 'You can take this quiz again. Your earlier attempts stay on your record.', 'tutor' ) )
->confirm_handler( 'retryMutation?.mutate({...payload?.data})' )
->confirm_text( __( 'Retry Quiz', 'tutor' ) )
->mutation_state( 'retryMutation' )
diff --git a/classes/Quiz_Attempts_List.php b/classes/Quiz_Attempts_List.php
index 83e6a49033..465c67de2e 100644
--- a/classes/Quiz_Attempts_List.php
+++ b/classes/Quiz_Attempts_List.php
@@ -640,6 +640,60 @@ public static function render_quiz_attempt_marks_percentage( $attempt_result = '
->render();
}
+ /**
+ * Render quiz attempt stats items.
+ *
+ * @since 4.3.0
+ *
+ * @param array $attempt Formatted quiz attempt data.
+ *
+ * @return void
+ */
+ public static function render_quiz_attempt_stats( array $attempt ): void {
+ $correct_answers = (int) ( $attempt['correct_answers'] ?? 0 );
+ $incorrect_answers = (int) ( $attempt['incorrect_answers'] ?? 0 );
+
+ $items = array(
+ 'correct' => array(
+ 'class' => 'tutor-quiz-marks-correct',
+ 'label' => sprintf(
+ /* translators: %d: number of correct answers */
+ _n( '%d correct', '%d correct', $correct_answers, 'tutor' ),
+ $correct_answers
+ ),
+ ),
+ 'incorrect' => array(
+ 'class' => 'tutor-quiz-marks-incorrect',
+ 'label' => sprintf(
+ /* translators: %d: number of incorrect answers */
+ _n( '%d incorrect', '%d incorrect', $incorrect_answers, 'tutor' ),
+ $incorrect_answers
+ ),
+ ),
+ );
+
+ /**
+ * Filters the stats items rendered in quiz attempt history.
+ *
+ * @since 4.3.0
+ *
+ * @param array $items Associative array of `key => [ 'class' => string, 'label' => string ]`.
+ * @param array $attempt Formatted quiz attempt data.
+ */
+ $items = apply_filters( 'tutor_quiz_attempt_stats', $items, $attempt );
+ ?>
+
+ total_questions ?? 0 ) : 0;
+ $answer_counts = QuizModel::get_attempt_answer_counts( $answers, $total_questions );
+ $skipped_count = (int) ( $answer_counts['skipped'] ?? 0 );
/**
* Build a count label with the number wrapped in markup,
@@ -686,11 +742,20 @@ public static function get_quiz_attempt_summary_statics( $attempt_data, $answers
),
'count' => (int) $answer_counts['incorrect'],
),
+ 'skipped' => array(
+ 'class' => 'skipped',
+ 'label' => $format_count_label(
+ $skipped_count,
+ /* translators: %1$s: number of skipped questions, wrapped in markup. */
+ _n( '%1$s skipped', '%1$s skipped', $skipped_count, 'tutor' )
+ ),
+ 'count' => $skipped_count,
+ ),
'total' => array(
'class' => 'total',
/* translators: %1$s: total number of questions, wrapped in markup. */
- 'label' => $format_count_label( $attempt_data->total_questions, __( '%1$s total', 'tutor' ) ),
- 'count' => (int) $attempt_data->total_questions,
+ 'label' => $format_count_label( $total_questions, __( '%1$s total', 'tutor' ) ),
+ 'count' => $total_questions,
),
);
@@ -721,7 +786,14 @@ public static function get_quiz_attempt_summary_statics( $attempt_data, $answers
*
* @return array Ordered associative array of `key => item` pairs.
*/
- return apply_filters( 'tutor_quiz_attempt_summary_statics', $static_items, $attempt_data, $answers );
+ $static_items = apply_filters( 'tutor_quiz_attempt_summary_statics', $static_items, $attempt_data, $answers );
+
+ return array_filter(
+ $static_items,
+ static function ( $item ) {
+ return is_array( $item ) && (int) ( $item['count'] ?? 0 ) > 0;
+ }
+ );
}
/**
diff --git a/components/ConfirmationModal.php b/components/ConfirmationModal.php
index d477917992..3a585a6c45 100644
--- a/components/ConfirmationModal.php
+++ b/components/ConfirmationModal.php
@@ -498,7 +498,7 @@ class="tutor-btn tutor-btn-secondary tutor-btn-small"
-
+
%s
%s
diff --git a/models/QuizModel.php b/models/QuizModel.php
index fd88311e02..98570d6ce0 100644
--- a/models/QuizModel.php
+++ b/models/QuizModel.php
@@ -262,6 +262,7 @@ public static function format_quiz_attempts( array $quiz_attempts, string $resul
'marks_percent' => $earned_percent ?? 0,
'correct_answers' => $correct_answers,
'incorrect_answers' => $incorrect_answers,
+ 'answer_counts' => $answer_counts,
'time_taken' => $attempt_time ?? '',
'date' => self::get_attempt_date( $quiz_attempt ),
'quiz_title' => $quiz_title,
@@ -1285,30 +1286,45 @@ public static function render_attempt_answer_badge( $attempt_answer, array $opti
/**
* Get attempt answer counts categorized by status.
*
- * Fully correct answers are counted under 'correct' and incorrect answers under 'incorrect'.
- * Pending, graded, and skipped answers are excluded.
+ * Fully correct answers are counted under 'correct', incorrect answers under 'incorrect',
+ * and skipped answers under 'skipped'. When total quiz questions is provided and exceeds
+ * non-skipped answer rows (e.g. when skipped rows were filtered out or not inserted),
+ * remaining questions are counted as 'skipped'. Pending and graded answers are excluded
+ * unless extended via the `tutor_quiz_attempt_answer_counts` filter.
*
* @since 4.1.0
+ * @since 4.3.0 Added skipped count and optional `$total_questions` parameter.
*
- * @param array|null $answers List of answer objects.
+ * @param array|null $answers List of answer objects.
+ * @param int $total_questions Optional total questions in the quiz attempt.
*
* @return array Associative array with answer status counts.
*/
- public static function get_attempt_answer_counts( $answers ): array {
+ public static function get_attempt_answer_counts( $answers, int $total_questions = 0 ): array {
$counts = array(
'correct' => 0,
'incorrect' => 0,
+ 'skipped' => 0,
);
+ $answered_count = 0;
+
if ( is_array( $answers ) ) {
foreach ( $answers as $answer ) {
$status = self::get_attempt_answer_status( $answer );
+ if ( 'skipped' !== $status ) {
+ ++$answered_count;
+ }
if ( isset( $counts[ $status ] ) ) {
++$counts[ $status ];
}
}
}
+ if ( $total_questions > $answered_count ) {
+ $counts['skipped'] = max( $counts['skipped'], $total_questions - $answered_count );
+ }
+
return apply_filters( 'tutor_quiz_attempt_answer_counts', $counts, $answers );
}
diff --git a/templates/dashboard/account/settings.php b/templates/dashboard/account/settings.php
index da3ce6947c..b86aedf220 100644
--- a/templates/dashboard/account/settings.php
+++ b/templates/dashboard/account/settings.php
@@ -12,6 +12,7 @@
* template: templates/account.php
*
* @var string $back_url
+ * @var string|null $close_url
*/
defined( 'ABSPATH' ) || exit;
@@ -92,7 +93,7 @@ function ( $tab ) {
return {
...tabs,
- backUrl: ,
+ closeUrl: ,
viewportWidth: window.innerWidth,
hasInitialUrlTab: tabs.tabs.some((tab) => tab.id === initialTab),
handleViewportResize() {
@@ -126,13 +127,14 @@ function ( $tab ) {
return tabs.selectTab.call(this, tabId);
},
- handleClose() {
- if (window.innerWidth < 768 && this.activeTab !== 'none') {
+ handleBack(event) {
+ if (window.innerWidth <= 768 && this.activeTab !== 'none') {
+ event?.preventDefault();
this.selectTab('none');
- return;
}
-
- window.location.href = this.backUrl;
+ },
+ handleClose() {
+ window.location.href = this.closeUrl;
},
};
})()"
diff --git a/templates/dashboard/account/settings/header.php b/templates/dashboard/account/settings/header.php
index 228ff07ab1..c85fcd6ee2 100644
--- a/templates/dashboard/account/settings/header.php
+++ b/templates/dashboard/account/settings/header.php
@@ -45,6 +45,7 @@ class="tutor-profile-header-left tutor-flex tutor-items-center"
->icon_only()
->flip_rtl()
->attr( 'href', esc_url( $back_url ) )
+ ->attr( '@click', 'handleBack($event)' )
->render();
?>
-
+
diff --git a/templates/shared/components/quiz/attempt-details/questions/fill-in-the-blank.php b/templates/shared/components/quiz/attempt-details/questions/fill-in-the-blank.php
index 444c291d45..ddb183a252 100644
--- a/templates/shared/components/quiz/attempt-details/questions/fill-in-the-blank.php
+++ b/templates/shared/components/quiz/attempt-details/questions/fill-in-the-blank.php
@@ -19,6 +19,7 @@
$question_answers = QuizModel::get_answers_by_quiz_question( (int) $question->question_id );
$question_answers = is_array( $question_answers ) ? $question_answers : array();
$given_values = array();
+$is_skipped = ! empty( $is_skipped );
if ( isset( $question->given_answer ) ) {
$given_raw = maybe_unserialize( $question->given_answer );
@@ -88,7 +89,7 @@ function () use ( &$idx, $values, $default_status ) {
$given_token_set[] = array(
'value' => $given_text,
- 'status' => $is_match ? 'correct' : 'incorrect',
+ 'status' => $is_skipped ? 'neutral' : ( $is_match ? 'correct' : 'incorrect' ),
);
$correct_set[] = array(
'value' => $correct_text,
@@ -97,7 +98,7 @@ function () use ( &$idx, $values, $default_status ) {
}
$given_cursor += $dash_count;
- $given_markup_lines[] = $render_sentence( $answer_title, $given_token_set, 'incorrect' );
+ $given_markup_lines[] = $render_sentence( $answer_title, $given_token_set, $is_skipped ? 'neutral' : 'incorrect' );
$correct_lines[] = $render_sentence( $answer_title, $correct_set, 'correct' );
?>
diff --git a/templates/shared/components/quiz/attempt-details/questions/review-answer-dnd.php b/templates/shared/components/quiz/attempt-details/questions/review-answer-dnd.php
index e305ac395a..1709e2934f 100644
--- a/templates/shared/components/quiz/attempt-details/questions/review-answer-dnd.php
+++ b/templates/shared/components/quiz/attempt-details/questions/review-answer-dnd.php
@@ -33,6 +33,7 @@
$question_answers = is_array( $question_answers ) ? array_values( $question_answers ) : array();
$given_raw = $question->given_answer ?? null;
$given_answer = maybe_unserialize( $given_raw );
+$is_skipped = ! empty( $is_skipped );
$normalize = static function ( $value ) {
return strtolower( trim( wp_strip_all_tags( (string) $value ) ) );
@@ -63,7 +64,7 @@
'given_image' => $selected_item ? $get_image_url( $selected_item ) : '',
'correct_text' => $correct_item->answer_title ?? '',
'correct_image' => $get_image_url( $correct_item ),
- 'given_status' => $is_row_ok ? 'correct' : 'incorrect',
+ 'given_status' => $is_skipped ? 'neutral' : ( $is_row_ok ? 'correct' : 'incorrect' ),
);
}
} elseif ( 'matching' === $question_type ) {
@@ -80,13 +81,13 @@
'given_image' => $is_image_matching && $selected_item ? $get_image_url( $selected_item ) : '',
'correct_text' => $correct_text,
'correct_image' => $is_image_matching ? $get_image_url( $correct_item ) : '',
- 'given_status' => $is_row_ok ? 'correct' : 'incorrect',
+ 'given_status' => $is_skipped ? 'neutral' : ( $is_row_ok ? 'correct' : 'incorrect' ),
);
}
} elseif ( 'image_answering' === $question_type ) {
$given_map = is_array( $given_answer ) ? $given_answer : array();
$answer_status = QuizModel::get_attempt_answer_status( $question );
- $row_item_state = 'correct' === $answer_status ? 'correct' : ( 'pending' === $answer_status ? 'pending' : 'incorrect' );
+ $row_item_state = $is_skipped ? 'neutral' : ( 'correct' === $answer_status ? 'correct' : ( 'pending' === $answer_status ? 'pending' : 'incorrect' ) );
foreach ( $question_answers as $correct_item ) {
$answer_id = (int) ( $correct_item->answer_id ?? 0 );
@@ -126,7 +127,7 @@
; ?>)
-
+
diff --git a/templates/shared/components/student-quiz-attempt-row.php b/templates/shared/components/student-quiz-attempt-row.php
index 8b65c413df..e886fd2967 100644
--- a/templates/shared/components/student-quiz-attempt-row.php
+++ b/templates/shared/components/student-quiz-attempt-row.php
@@ -109,34 +109,7 @@