Skip to content

Conversation

@Anindra123
Copy link
Collaborator

@Anindra123 Anindra123 commented Dec 22, 2025

Overview

This pr introduces a UI design overhaul for Quiz Attempts page for Instructor on frontend dashboard. The page has been made dynamic with PHP components that was created.

Changes

  • A new method format_quiz_attempts() was added in QuizModel class, this takes the query result of all the quiz attempts and formats it in an array for rendering the quiz attempt list properly.
    • This is done because the current query result returns list of attempts
    • Instead i need the quiz attempts in following format
     array(
     	'quiz_id' => '',
     	'course_title' => '',
     	'quiz_title' => '',
     	'attempts' => array()
     );
    
    • This ensures the nesting of attempts work, since multiple attempts are under a single quiz.
  • Another method get_quiz_attempts_nav_data() was added in Quiz_Attempt_List which provides the nav links to be used by the Nav php dynamic UI component .
  • Pagination is done from the array instead of the query by using array_slice().
  • Replaced the kebab menu for each quiz item in list with Popover php dynamic UI component.
  • Also replaced the badges with its relative php UI component.
  • Utilized Confirmation Modal php component for deletion confirmation.
  • Added SearchFilter , Sorting components for searching and sorting list
  • Utilized DateFilter component and added the following changes to it :
    • Added size() attribute for setting the button size.
    • Added icon_size() attribute for setting the icon size.
  • Made the design mobile responsive.
Dashboard-Page-–-tutor-dev

Mobile Responsive Design

localhost_10010_dashboard-page_quiz-attempts__result=pending (1)

@Anindra123 Anindra123 added the 4.0.0 Tutor v4.w0w label Dec 22, 2025
@Anindra123 Anindra123 marked this pull request as ready for review December 23, 2025 09:28
@@ -29,6 +29,7 @@
@include tutor-breakpoint-down(sm) {
padding-bottom: $tutor-spacing-16;
}
padding-bottom: $tutor-spacing-7;
Copy link
Collaborator

Choose a reason for hiding this comment

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

already has padding-bottom at line number: 27

tutor_load_template_from_custom_path( $pagination_template_frontend, $pagination_data );
}
?>
$confirm_delete = Button::make()->label( __( "Yes, I'm sure", 'tutor' ) )
Copy link
Collaborator

Choose a reason for hiding this comment

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

I have made a delete confirmation modal component. Please use there here after my PR is merged.

@@ -0,0 +1,23 @@
<?php
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 if delete confirmation modal component is used

@@ -33,7 +33,7 @@

&-header {
display: grid;
grid-template-columns: 340px 180px 1.5fr 1fr;
grid-template-columns: 300px 180px 1.5fr 1fr;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Double check with the design.

@use '@Core/scss/tokens' as *;
@use '@Core/scss/mixins' as *;

.tutor-quiz-attempts-mobile-heading {
Copy link
Collaborator

Choose a reason for hiding this comment

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

use utility classes for this.

}
}

&.mobile-filter {
Copy link
Collaborator

Choose a reason for hiding this comment

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

use grid for responsive design instead of using double markup.

*
* @return self
*/
public function size( string $size ): self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rename this to trigger_size

$instructor_name = tutor_utils()->display_name( $author_id );
$instructor_url = tutor_utils()->profile_url( $author_id, true );
} elseif ( tutor()->lesson_post_type === $post_type ) {
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why?

Copy link
Collaborator

@shewa12 shewa12 left a comment

Choose a reason for hiding this comment

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

Please check the request changes.

$quiz_id = $quiz_attempt->quiz_id ?? 0;
$course_id = $quiz_attempt->course_id ?? 0;

$course_title = get_the_title( $course_id ) ?? '';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Quiz attempts have the course ID, if we take the title too, then we can skip the get_post_title for each quiz attempt.

* @since 4.0.0
*/

$attempts_count = count( $attempts );
Copy link
Collaborator

Choose a reason for hiding this comment

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

First need to check if the $attempts var is an array then count

$attempts_count = $attempts_count ?? 0;
$badge = Badge::make()->label( 'Failed' )->variant( Variant::CANCELLED )->circle();
$kebab_button = Button::make()
->icon(
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 just use the icon name in the following way:

							Button::make()
								->label( 'Switch to Learner' )
								->size( Size::MEDIUM )
								->variant( Variant::PRIMARY_SOFT )
								->icon( Icon::RELOAD )
								->attr( 'data-id', 101 )
								->render();

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