Skip to content
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

Update stylings for footer in awaiting grade quizzes in learning mode #7190

Merged
merged 26 commits into from
Oct 2, 2023

Conversation

Imran92
Copy link
Contributor

@Imran92 Imran92 commented Sep 27, 2023

Resolves #7101

Proposed Changes

  • Updated block markups and stylings for the footer of quizzes awaiting grading

Testing Instructions

  1. Create a course with a lesson with a quiz
  2. Make sure you have LM enabled for the course and auto grading disabled (or have at least one question in the quiz that is not auto-gradable, like the multi-line question) for that quiz
  3. Take the quiz
  4. Make sure the footer matches the design
  5. Try enabling and disabling retakes for the quiz and make sure the design matches in those cases as well
  6. Check for All variations of the Course theme and other themes as well, especially Divi and Astra
  7. Check on mobile view as well for those states
  8. Check that the footer of the lesson looks as it used to do
  9. Check that the non-LM design isn't broken

In the design, the variations of Course theme have 0.6 opacity, but the default variation has 0.4, so I only set the 0.4, and didn't add 0.6 for the variations because it'd require adding CSS as string in all the JSON files of the variations which is not very manageable. 0.2 difference in opacity hopefully shouldn't feel too different in the variations.

Desktop:
Screenshot 2023-09-27 at 5 50 42 PM

Desktop - without retakes:
Screenshot 2023-09-27 at 5 28 16 PM

Mobile:
Screenshot 2023-09-27 at 5 51 02 PM

Pre-Merge Checklist

  • PR title and description contain sufficient detail and accurately describe the changes
  • Acceptance criteria is met
  • Decisions are publicly documented
  • Adheres to coding standards (PHP, JavaScript, CSS, HTML)
  • All strings are translatable (without concatenation, handles plurals)
  • Follows our naming conventions (P6rkRX-4oA-p2)
  • Hooks (p6rkRX-1uS-p2) and functions are documented
  • New UIs are responsive and use a mobile-first approach
  • New UIs match the designs
  • Different user privileges (admin, teacher, subscriber) are tested as appropriate
  • Code is tested on the minimum supported PHP and WordPress versions
  • User interface changes have been tested on the latest versions of Chrome, Firefox and Safari
  • "Needs Documentation" label is added if this change requires updates to documentation
  • Known issues are created as new GitHub issues

@Imran92 Imran92 added this to the 4.17.1 milestone Sep 27, 2023
@Imran92 Imran92 self-assigned this Sep 27, 2023
@Imran92 Imran92 requested a review from a team September 27, 2023 13:23
@Imran92 Imran92 closed this Sep 27, 2023
@Imran92 Imran92 reopened this Sep 27, 2023
@Imran92 Imran92 changed the title Add/stylings for footer in awaiting grade quiz lm Update stylings for footer in awaiting grade quizzes in learning mode Sep 27, 2023
@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Merging #7190 (1a27979) into trunk (349453d) will increase coverage by 0.19%.
Report is 1 commits behind head on trunk.
The diff coverage is 76.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##              trunk    #7190      +/-   ##
============================================
+ Coverage     49.83%   50.03%   +0.19%     
- Complexity    10684    10698      +14     
============================================
  Files           601      601              
  Lines         45160    45182      +22     
  Branches        402      402              
============================================
+ Hits          22504    22605     +101     
+ Misses        22329    22250      -79     
  Partials        327      327              
Files Coverage Δ
...ludes/blocks/course-theme/class-lesson-actions.php 98.01% <75.00%> (-0.95%) ⬇️
includes/class-sensei-quiz.php 65.96% <76.19%> (+6.44%) ⬆️

... and 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2e9b39b...1a27979. Read the comment docs.

$is_learning_mode = \Sensei_Course_Theme_Option::has_learning_mode_enabled( $course_id );
$is_awaiting_grade = false;

$lesson_status = \Sensei_Utils::user_lesson_status( $lesson_id, get_current_user_id() );
Copy link
Contributor

Choose a reason for hiding this comment

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

The Psalm is marking an issue here. Could we fix the PHPDoc return of user_lesson_status to also have an array of WP_Comments, which seems to be another possible return?

Comment on lines 164 to 177
$is_learning_mode = \Sensei_Course_Theme_Option::has_learning_mode_enabled( $course_id );
$is_awaiting_grade = false;

$lesson_status = \Sensei_Utils::user_lesson_status( $lesson_id, get_current_user_id() );

if ( $lesson_status ) {
$lesson_status = is_array( $lesson_status ) ? $lesson_status[0] : $lesson_status;

$is_awaiting_grade = 'ungraded' === $lesson_status->comment_approved;
}

if ( $is_learning_mode && $is_awaiting_grade && 'quiz' === get_post_type() ) {
return '';
}
Copy link
Contributor

Choose a reason for hiding this comment

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

WDYT to extract these lines to a private method returning a boolean? This render method seems to be a method growing too much. 🤭

Comment on lines 1860 to 1869
$is_learning_mode = Sensei_Course_Theme_Option::has_learning_mode_enabled( $course_id );
$is_awaiting_grade = false;

$lesson_status = \Sensei_Utils::user_lesson_status( $lesson_id, get_current_user_id() );

if ( $lesson_status ) {
$lesson_status = is_array( $lesson_status ) ? $lesson_status[0] : $lesson_status;

$is_awaiting_grade = 'ungraded' === $lesson_status->comment_approved;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Related to the previous comment, maybe we could have that method in this class being used in both places to avoid duplication? WDYT?
Feel free to disagree since I'm re-learning about Sensei and probably missing a lot of context. 🙂

@renatho
Copy link
Contributor

renatho commented Sep 29, 2023

Also, not related to this PR, I'd like to tell you something I noticed.
Not sure if it's part of one of the other issues of Frontend improvements.

The course title in the learning mode looks like this for me:

Screenshot 2023-09-29 at 14 23 06

Copy link
Contributor

@renatho renatho left a comment

Choose a reason for hiding this comment

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

Looks good and works well!

I just noticed one last thing, but I'm not sure if it's expected, so I'm already approving it. 😉 In Divi and Twenty Twenty-Three themes there is an extra spacing around the buttons.

Screenshot 2023-10-02 at 11 01 54

It seems the same doesn't happen for the questions because of this class with the max-width:

Screenshot 2023-10-02 at 11 00 45

@Imran92
Copy link
Contributor Author

Imran92 commented Oct 2, 2023

Looks good and works well!

I just noticed one last thing, but I'm not sure if it's expected, so I'm already approving it. 😉 In Divi and Twenty Twenty-Three themes there is an extra spacing around the buttons.

Screenshot 2023-10-02 at 11 01 54 It seems the same doesn't happen for the questions because of this class with the `max-width`: Screenshot 2023-10-02 at 11 00 45

Good catch @renatho ! Thank you! ☺️ I've also noticed this today while working on this issue #7116. As these both issues are addressing the same footer in the template, I'll address it in the PR for #7116 issue

@Imran92 Imran92 merged commit ad6ac8c into trunk Oct 2, 2023
23 checks passed
@Imran92 Imran92 deleted the add/stylings-for-footer-in-awaiting-grade-quiz-lm branch October 2, 2023 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update quiz footer when awaiting grade
2 participants