Skip to content

Conversation

@Anindra123
Copy link
Collaborator

@Anindra123 Anindra123 commented Jan 26, 2026

Overview

This PR adds the new quiz attempt page design for courses tab on student frontend view.

Changes

  • Utilized already existing quiz attempt page design for instructor
  • Added attempt_info to check whether quiz attempt can be retried
  • Also added is_student which checks if current user is student to load appropriate component for each quiz attempt page view
  • Replace Nav component with DropDownFilter component for both student and instructor quiz attempt page design
  • Added Confirmation Modal for confirming whether to retry quiz
  • Added retryMutation for handing retrying of quiz attempts
  • Added functional code in Quiz_Attempts_List class
  • Added the method should_retry in Quiz_Attempts_List class to check if attempt can be retried.
  • Retry Button for mobile view all the logic for rendering are place in render_retry_button inside Quiz_Attempts_List class
  • Added a new attempt row template called student-quiz-attempt-row for student quiz attempt list

Desktop View

Screenshot 2026-01-27 at 5 25 13 PM

Mobile Responsive

Screenshot 2026-01-27 at 5 27 04 PM

@Anindra123 Anindra123 added the 4.0.0 Tutor v4.w0w label Jan 26, 2026
@Anindra123 Anindra123 marked this pull request as ready for review January 27, 2026 11:28
->render();
?>
<?php endif; ?>
<div class="tutor-p-6">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can pass classes directly to the Pagination component using attr. also remove the prev, and next function calls.

)
)
);
$retry_button = Button::make()->label( __( 'Retry', 'tutor' ) )
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This button was used only in one place. so, why define a variable?

* @return boolean
*/
public function is_tutor_frontend_dashboard( $subpage = null ) {
public function is_tutor_frontend_dashboard( $subpage = '' ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I solved this by add a if condition in my PR.

RESET_PASSWORD: 'tutor_profile_password_reset',

// Quiz Attempts
START_QUIZ: 'tutor_start_quiz',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this with other quiz endpoints.

},

async handleRetryAttempt(payload: RetryAttempt) {
await this.retryMutation?.mutate(payload);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can directly call this from template retryMutation?.mutate(payload)



Popover::make()
if ( $is_student && ! $should_retry ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put all student related items inside one block.

use TUTOR\User;

$attempts_count = tutor_utils()->count( $attempts );
$is_student = User::is_student( get_current_user_id() ) && tutor_utils()->is_enrolled( $course_id, get_current_user_id(), false );
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also consider the view as student and instructor option.

window.location.href = payload.redirectURL;
},
onError: (error: Error) => {
window.TutorCore.toast.error(error.message || 'Failed to retry quiz attempt');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this line
window.TutorCore.toast.error(error.message || 'Failed to retry quiz attempt');
With this:
window.TutorCore.toast.error(convertToErrorMessage(error))

->attr( '@click', $delete_attr )
->variant( 'secondary' );

$details_item = array(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to shift all the functional codebase to the Controller Class file.

SAVE_WITHDRAW_METHOD: 'tutor_save_withdraw_account',
RESET_PASSWORD: 'tutor_profile_password_reset',
UPDATE_PROFILE_NOTIFICATION: 'tutor_save_notification_preference'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why empty line?

?>
<?php endif; ?>
<?php
if ( $quiz_attempts_count > $item_per_page ) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need this condition. it's managed inside pagination component.

* @return void
*/
public function render_retry_button( $course_id = 0, $quiz_id = 0, $attempt = array(), $attempts_count = 0 ) {
$view_mode = User::VIEW_AS_STUDENT === User::get_current_view_mode();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the name of the variable $view_mode is confusing. is should be something like $is_student_view. also check the condition as we discussed.

* @return string
*/
public function get_quiz_attempt_row_template( $course_id = 0 ): string {
$view_mode = User::VIEW_AS_STUDENT === User::get_current_view_mode();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same condition in 2 place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0.0 Tutor v4.w0w

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants