Added New Quiz Attempts Courses Tab Page Design for student#2334
Added New Quiz Attempts Courses Tab Page Design for student#2334
Conversation
| ->render(); | ||
| ?> | ||
| <?php endif; ?> | ||
| <div class="tutor-p-6"> |
There was a problem hiding this comment.
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' ) ) |
There was a problem hiding this comment.
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 = '' ) { |
There was a problem hiding this comment.
I solved this by add a if condition in my PR.
| RESET_PASSWORD: 'tutor_profile_password_reset', | ||
|
|
||
| // Quiz Attempts | ||
| START_QUIZ: 'tutor_start_quiz', |
There was a problem hiding this comment.
Add this with other quiz endpoints.
| }, | ||
|
|
||
| async handleRetryAttempt(payload: RetryAttempt) { | ||
| await this.retryMutation?.mutate(payload); |
There was a problem hiding this comment.
we can directly call this from template retryMutation?.mutate(payload)
|
|
||
|
|
||
| Popover::make() | ||
| if ( $is_student && ! $should_retry ) { |
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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' | ||
|
|
| ?> | ||
| <?php endif; ?> | ||
| <?php | ||
| if ( $quiz_attempts_count > $item_per_page ) { |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
Same condition in 2 place.
Overview
This PR adds the new quiz attempt page design for courses tab on student frontend view.
Changes
attempt_infoto check whether quiz attempt can be retriedis_studentwhich checks if current user is student to load appropriate component for each quiz attempt page viewNavcomponent withDropDownFiltercomponent for both student and instructor quiz attempt page designretryMutationfor handing retrying of quiz attemptsQuiz_Attempts_Listclassshould_retryin Quiz_Attempts_List class to check if attempt can be retried.render_retry_buttoninside Quiz_Attempts_List classstudent-quiz-attempt-rowfor student quiz attempt listDesktop View
Mobile Responsive