-
Notifications
You must be signed in to change notification settings - Fork 82
Added New Quiz Attempts Courses Tab Page Design for student #2334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.0.0-dev
Are you sure you want to change the base?
Conversation
| ->render(); | ||
| ?> | ||
| <?php endif; ?> | ||
| <div class="tutor-p-6"> |
There was a problem hiding this comment.
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' ) ) |
There was a problem hiding this comment.
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?
classes/Utils.php
Outdated
| * @return boolean | ||
| */ | ||
| public function is_tutor_frontend_dashboard( $subpage = null ) { | ||
| public function is_tutor_frontend_dashboard( $subpage = '' ) { |
There was a problem hiding this comment.
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', |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 ) { |
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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'); |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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' | ||
|
|
There was a problem hiding this comment.
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 ) { |
There was a problem hiding this comment.
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.
classes/Quiz_Attempts_List.php
Outdated
| * @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.
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.
classes/Quiz_Attempts_List.php
Outdated
| * @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.
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.
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