Skip to content

EQM: Validation improvements #12281

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

Merged

Conversation

nucleogenesis
Copy link
Member

@nucleogenesis nucleogenesis commented Jun 13, 2024

Summary

  • Scroll to and focus quiz title when blank during quiz submission
  • trim() section_title all about so we're always testing "is this unique" correctly
  • Adds "Are you sure" message when leaving quiz creation and can lose your changes.

I think that "fix the snackbars" can be done in a follow-up -- there is no change to strings, but just a need to use displaySectionTitle throughout.

References

Closes #12262

Reviewer guidance

  • Try making duplicate section titles
  • Try exiting an un-edited quiz (should not see a modal)
  • Try exiting a quiz you've changed something on (should see a modal)
  • Do the exiting test on both a "draft" quiz and a "started" quiz
  • See that when you have errors on the Title (ie, it is blank or not unique) you should be scrolled to it

@github-actions github-actions bot added APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend SIZE: small labels Jun 13, 2024
@nucleogenesis nucleogenesis requested a review from rtibbles June 13, 2024 21:41
@nucleogenesis nucleogenesis marked this pull request as ready for review June 13, 2024 23:46
Copy link
Member

@rtibbles rtibbles left a comment

Choose a reason for hiding this comment

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

This all makes sense from a code perspective - I have not tested though.

Copy link
Member

@marcellamaki marcellamaki left a comment

Choose a reason for hiding this comment

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

I adding a few admittedly nit-picky (and non-blocking) suggestions, but the validation improvements, which are the most critical thing, are working as expected. 🎉

@@ -63,6 +65,7 @@ export default function useQuizCreation() {
* @throws {TypeError} if section is not a valid QuizSection
**/
function updateSection({ section_id, ...updates }) {
set(quizHasChanged, true);
Copy link
Member

Choose a reason for hiding this comment

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

is it ever possible for updateSection to be called when there are not actually any changes?

Copy link
Member

Choose a reason for hiding this comment

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

I think probably the more likely case is for someone to change something, then change it back - in which case this would be set to true, and there not actually be any changes. I think that edge case is worth having for the sake of simplicity (rather than deep diff checking).

Copy link
Member

Choose a reason for hiding this comment

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

yes - that makes sense!

@@ -53,6 +53,19 @@

</KPageContainer>

<KModal
v-if="goingTo"
Copy link
Member

Choose a reason for hiding this comment

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

this is absolutely a nit but could you change this to something that makes it a bit clearer about what this is just from reading the variable name? i.e. a route object, a boolean, etc.

@@ -318,6 +317,9 @@
handleSubmitTitleFailure() {
this.formIsSubmitted = false;
this.showTitleError = true;
this.$refs.titleField.focus();
// Scroll to the title field in case focus() didn't do that immediately
this.$refs.titleField.$el.scrollIntoView({ behavior: 'smooth' });
Copy link
Member

Choose a reason for hiding this comment

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

non-blocking: my only suggestion for here is that maybe we just scroll to the top of the page, since the app bar is covering the field with the default scroll behavior?

scroll-into-view.mp4

Copy link
Member

@marcellamaki marcellamaki left a comment

Choose a reason for hiding this comment

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

ty @nucleogenesis ! looks great

@nucleogenesis nucleogenesis force-pushed the fix--make-eqm-validations-good branch from e1b86a6 to 934b947 Compare June 14, 2024 21:51
@nucleogenesis nucleogenesis force-pushed the fix--make-eqm-validations-good branch from 934b947 to 9c36032 Compare June 14, 2024 21:51
@rtibbles rtibbles merged commit 5efc04c into learningequality:develop Jun 14, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend SIZE: small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EQM: Section form validation improvements
3 participants