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

Fix single quiz selection flow #12274

Merged
merged 23 commits into from
Jun 17, 2024

Conversation

rtibbles
Copy link
Member

Summary

  • Updates routing for quiz creation to use sectionIndex and make the URL the source of truth for the active section
  • Updates question titles to be blank when not set by user for future updates when we allow them to be editable
  • Updates question title display to account for this.
  • Fixes a previously unreported bug where the fetch for resources was not filtering properly
  • Updates strings for the SectionEditor component
    Before:
    Screenshot from 2024-06-11 17-15-55
    After:
    Screenshot from 2024-06-11 17-27-40
  • Updates the select quiz workflow to use the new components and state, with some minor tweaks for the quiz creation flow for this:
    • Separates out resource_pool updating to a separate method so that we can directly set values without triggering randomized question setting
    • Conditionalizes the resource selection modal to behave differently depending on whether we are selecting a quiz
  • Cleans up all unused components and vuex state

References

Fixes #12247

Reviewer guidance

Ensure you have practice quizzes imported.
Choose the 'select a quiz' option from the create quiz dropdown.
Ensure you can select a quiz and then create a quiz from there.
Ensure that this has not induced any regressions in the main quiz creation experience.


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... APP: Device Re: Device App (content import/export, facility-syncing, user permissions, etc.) APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend SIZE: very large labels Jun 12, 2024
@pcenov
Copy link
Member

pcenov commented Jun 12, 2024

Hi @rtibbles,

  1. I am always getting a server error when I select a practice quiz (or just create a quiz from scratch), save it and then attempt to start it:
Server.error.mp4
  1. When I am adding a section, or replacing questions and I click 'Save changes' the modal remains open and I have to click multiple times the back arrow to exit it:
no.escape.mp4
  1. When I create a brand new quiz and I click the Save button there's a brief flash of the validation message for the quiz title, and then if I click the Save button again it's no longer possible to save the quiz with the same title:
validation.mp4
  1. I can't delete a single or a few of the questions in the section, getting a TypeError: Cannot update both questionsandquestion_count at the same time; use one or the other. Deleting all of the questions is working though.
delete.stuff.mp4

Logs: logs.zip

@rtibbles
Copy link
Member Author

Thanks @pcenov!

@nucleogenesis
Copy link
Member

@rtibbles I think Peter's #3 can be covered in #12262

@rtibbles
Copy link
Member Author

I think I have addressed all issues bar 3 - which I think @nucleogenesis is tackling elsewhere.

I think this also addresses #12246.

It also updates the resource selection flow to be about adding new questions specifically, with each 'update resources' allowing you to choose how many questions you are selecting and choosing resources to fill those questions.

I implemented this after discussion with @marcellamaki and @nucleogenesis about the counterintuitiveness of selecting resources first and only then deciding the number of questions. Interest in thoughts and feedback, although I think a lot of the strings could definitely do with being reworded.

@pcenov
Copy link
Member

pcenov commented Jun 13, 2024

Hi @rtibbles, I've had a look at the latest changes here and:

  1. When I select a quiz, then none of the questions are getting displayed in the section. There's a TypeError: Cannot read properties of undefined (reading 'title') error in the console. It's also not possible to add the questions manually:
select.quiz.mp4
  1. Similarly when I create a new quiz, add a new section and attempt to add questions I am getting a "TypeError: Cannot read properties of undefined (reading 'ancestors')" error in the console and I can neither add more questions or close the modal by clicking outside:
add.section.mp4

@rtibbles
Copy link
Member Author

Irritating, I had both those errors in development, but thought I had addressed them - sorry for the wild goose chase.

Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

Manual testing notes

Resource selection # questions selected, resources previously selected

2024-06-13.09-06-46.mp4

Number of questions changes not save-able unless you change your resource selection (and the selectAll is visible at the end when it shouldn't be)

2024-06-13.09-09-00.mp4

Adding resources adds a number of questions in excess of the defined question_count on save, but does not impact the value in the form input

2024-06-13.09-10-22.mp4

@rtibbles
Copy link
Member Author

@pcenov I replicated and think I have fixed both of the issues you experienced.

@nucleogenesis I updated copy to make it clear that all of the issues you raised are now intended behaviour (we have also talked about this extensively in person and on slack).

@pcenov
Copy link
Member

pcenov commented Jun 14, 2024

Hi @rtibbles - I confirm that both issues are fixed now. I'll just mention here some other issues which I noticed while regression testing but maybe it's better to have everything merged and then to test everything again:

  1. Missing snackbar confirmation message when saving a quiz:
No.snackbar.that.the.changes.have.been.saved.mp4
  1. When I want to replace questions if I select more than the needed number of questions and then try to correct the mistake, the Replace button remains disabled and the number of questions in "Select N fewer questions to continue" is incorrect:
replace.questions.mp4
  1. When adding questions, there needs to be more padding under the text "Each section may only contain up to 50 questions, this section has 0":

2024-06-14_13-30-46

  1. It's still not possible to exit the "Add questions" modal by clicking outside of it (as is the case with the "Options" modal", so if I have been exploring a channel I have to repeatedly click the back arrow and confirm the "Are you sure you want to leave this page?" prompt before being able to actually exit the modal:
modal.mp4

@rtibbles
Copy link
Member Author

Yeah, I can fix 3 here, as that text has been added within this PR, but the other issues are probably best dealt with elsewhere!

We are planning on holding off merging this PR until Monday, so that we can test out the original workflow for managing questions by adding and removing resources vs the newer workflow of just incrementally adding questions from resources that I have implemented here.

Glad to know that it is generally working though!

@rtibbles
Copy link
Member Author

Have updated the margin top on the topic warning
Screenshot from 2024-06-14 07-46-17

Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

Only one blocking error and some comments - my review isn't complete yet but I have to come back to finish later on.

@@ -483,7 +619,12 @@
fetchMoreResources,
resetWorkingResourcePool,
contentPresentInWorkingResourcePool,
//contentList,
questionCount,
Copy link
Member

Choose a reason for hiding this comment

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

contentPresentInWorkingResourcePool (named on the line above) is failing for me when I go through to the QA Channel -> Exercises

I have a KA Perseus topic which has no children so when the card for that KA Perseus topic is passed to contentPresentInWRP it has no children, which chokes up the function.

Copy link
Member

Choose a reason for hiding this comment

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

Might just work well to filter out empty topics to begin with - which I thought we'd been doing 🤔

class="content-checkbox"
:label="content.title"
:showLabel="false"
:checked="contentIsChecked(content)"
:indeterminate="contentIsIndeterminate(content)"
@change="handleCheckboxChange(content, $event)"
/>
<KRadioButton
v-else-if="contentHasCheckbox(content) && showRadioButtons"
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, minor bug:

When I select the quiz and hit the confirm button, the KRadioButton disappears briefly before redirecting. It is very pronounced on "Fast 3G" throttling.

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 maybe "just use this on Fast 3G for a bit and fix what you see" could be a solid theme for a cohack, some things I noticed before I couldn't handle it anymore:

Note, I have my cache disabled as well, so all typically cached API calls & resources would likely be much faster, but this is worth polishing

  • Click "Add section" -- the section tab is added... then nothing for a few seconds... then the slideout appears w/ the section settings
  • Click "Add questions" -- basically the same, nothing happens - the page doesn't start spinning... it just sits there until the new content is displayed
  • Basically a lot of transitions are met with a blank stare and sudden change rather than a spinner or some other indication of "something is happening just wait a sec"

Again -- not blocking, just noticed during testing here and can put into follow-up today

Comment on lines +5 to +22
const EXERCISES = [
{
id: 'A',
title: 'title_x',
assessmentmetadata: { assessment_item_ids: ['A1', 'A2', 'A3'] },
},
{
id: 'B',
title: 'title_y',
assessmentmetadata: { assessment_item_ids: ['B1', 'B2', 'B3', 'B4', 'B5', 'B6', 'B7', 'B8'] },
},
{
id: 'C',
title: 'title_z',
assessmentmetadata: {
assessment_item_ids: ['C1', 'C2', 'C3', 'C4', 'C5', 'C6', 'C7', 'C8', 'C9'],
},
},
Copy link
Member

Choose a reason for hiding this comment

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

So much prettier <3

Comment on lines +11 to +25
export function exerciseToQuestionArray(exercise) {
return exercise.assessmentmetadata.assessment_item_ids.map((question_id, i) => {
return {
exercise_id: exercise.id,
question_id,
counter_in_exercise: i + 1,
// In the V3 schema, the title is user editable, and no longer
// simply the title of the exercise the question came from.
// We set it to blank to indicate that no user generated title
// has been created.
title: '',
item: `${exercise.id}:${question_id}`,
};
});
}
Copy link
Member

Choose a reason for hiding this comment

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

Love this

Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

Non-blocking issue:

  • Select a practice quiz with only a few questions
  • Select those questions and then click to replace them
  • You shouldn't have enough replacements, now if you click "Add resources" on that model, you open the Resource Selection

The issue is that the resource side panel opens to the Practice Quiz resource which I've already added instead of the channels list

Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

Save followed by immediate Save & Close isn't working here:

2024-06-14.16-29-54.mp4

@rtibbles
Copy link
Member Author

I think both of the things you observed here should now be fixed @nucleogenesis - I have also tweaked the warning modal shown when there are not enough replacements to better represent the current state in this PR.

@radinamatic
Copy link
Member

I'm struggling a bit around wrapping my brain around all the changes here... 😅

Some re-wording suggestions:

  1. Questions here are past selected (since we use that term for states where user actively uses checkboxes to select), so maybe this string should be straight-up: Number of questions: 5

    2024-06-17_02-33-41
  2. I suggest we simplify this whole area (marked in orange in the screenshot below) - cc @tomiwaoLE


    ⬅️ Add questions to <section_name> (modal title - H1)

    Current number of questions: 5
    Number of questions to add: (input field with the counter, default value 0)

    Select exercise resources to add questions

    <breadcrumbs>
    <search field>
    ...


    2024-06-17_02-26-57
  3. Marked in red above is the overlap between question description and the string N questions unused. I would also maybe suggest the change to N unused questions available.

  4. If we do go with my suggestion above it might not be visible, but even after I installed the latest asset today, there's still missing margin/padding above the search field:

Firefox Chrome
firefox-missing-margin chrome-missing-margin
  1. For some reason I'm getting the network error when I try to play the videos above by @pcenov and @nucleogenesis , so this might have already been mentioned, but something is borked in the counter of questions to replace:
replacements-counter.mp4

Update exam utils spec to properly assert conversions being tested against V3.
Update QuestionListPreview for just read only usage.
Update display of questions.
Just return to root quiz page on save.
Update v3 conversion logic to constrain section length.
Make string parameterized in case of changes.
Ensure we don't show any topics without children, even if the unfiltered num assessments says otherwise.
Update strings for replacements modal to reflect updated workflow.
Copy link
Member

@nucleogenesis nucleogenesis left a comment

Choose a reason for hiding this comment

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

This looks good - let's merge and the issues noted in the bug bash can be replicated and made into issues today

@nucleogenesis nucleogenesis merged commit f038d23 into learningequality:develop Jun 17, 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.) APP: Device Re: Device App (content import/export, facility-syncing, user permissions, etc.) DEV: backend Python, databases, networking, filesystem... DEV: frontend SIZE: very large
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Select a quiz' is not working
4 participants