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

Implement new questions replacement #13180

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from

Conversation

AlexVelezLl
Copy link
Member

@AlexVelezLl AlexVelezLl commented Mar 10, 2025

Summary

  • Implement new manual questions replacement according to the specs
  • Remove old question replacement component, and related methods.
Compartir.pantalla.-.2025-03-10.13_25_40.mp4

References

Closes part of #13108, auto-replace is out of scope of this PR

Reviewer guidance

  • Go to coach/quizzes/create new quiz
  • Add questions to the section either manually or randomly.
  • Use the new "replace" button in the question accodion and replace the question with one/multiple questions in manual/random selection mode.
  • Try replacing questions from different parts of the questions list and check that it works well in all cases

@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend labels Mar 10, 2025
@AlexVelezLl AlexVelezLl force-pushed the questions-replacement branch 2 times, most recently from 28d90b4 to 6681c36 Compare March 10, 2025 18:44
@AlexVelezLl AlexVelezLl removed the DEV: backend Python, databases, networking, filesystem... label Mar 10, 2025
@marcellamaki
Copy link
Member

marcellamaki commented Mar 10, 2025

@pcenov and @radinamatic this will be a top priority for testing tomorrow - i'll be starting code review now

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.

Didn't see anything blocking - just added a question. Overall the code LGTM, but will leave approval to the assigned reviewers

@@ -115,7 +126,24 @@ export default function useQuizCreation() {
});
}

function addQuestionsToSectionFromResources({ sectionIndex, resourcePool, questionCount }) {
function _insertItemsAt(baseArray, itemsToInsert, index) {
Copy link
Member

Choose a reason for hiding this comment

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

Did you consider using splice instead of making a function? For whatever is passed in as baseArray you could do baseArray.splice(index, 0, itemsToInsert) - although it does mutate the array in place.

Not blocking as this looks good overall and I see you're doing checks on the passed index as well, it just got me thinking

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh I didnt 😅. I just refactored the function to use the splice making a copy of the baseArray instead and it looks so much cleaner. Thanks @nucleogenesis!

@pcenov
Copy link
Member

pcenov commented Mar 11, 2025

  1. After having added questions to a section if I select some or all of the questions the "Select all", "Replace" and "Delete" options are not working. Looking at Figma it seems that the "Replace" option should be removed but the other 2 should be functioning normally unless otherwise specified:
options-not-working.mp4
  1. When I select a single question now it is possible to replace it with multiple other questions if there are available questions but at the same time I can't see a way of bulk replacing several of my questions - mentioning this as confusing and not very comfortable or intuitive.
  2. In addition to the above point, after I have just added several questions as a replacement to the one I've selected, then the question list is not refreshed automatically and there's no snackbar message confirming the successful replacement:
replaced.or.not.mp4
  1. When replacing questions I would expect the label of the button "Add N questions" to be changed to "Replace N questions". This is also valid for the title of the modal which is confusingly also labeled "Add questions to "Section 1". Lastly if I have already added the max number of questions when I try to replace 1 I am seeing the button "Add N questions" grayed out and labeled "Add 0 questions" while I would expect it to be "Replace 1 question":
add.0.mp4
  1. If I switch off the manual selection it's not clear at all why I can't add additional questions:
the.button.remains.disabled.mp4

@AlexVelezLl
Copy link
Member Author

Ah my apologies, I somehow messed things up with the version control and it seems that some changes were reverted 😅. Just pushed again the fix for 1 and 3.

For point 2: It wasnt supposed to be visible the bulk replace icon anymore. Now we can replace one question at a time. Knowing this, as a user, do you think that replacing one question with multiple quesitons is confusing? This is something we are still evaluating.

Points 4 and 5 are things that we can evaluate from the design perspective cc: @marcellamaki @jtamiace.

Just fyi: The reason why we cant save the selected resource in point 5 is because when we uncheck the manual selection mode, we set the number of questions to select to the default value: 10. And if the current resource doesnt have 10 available questions, then it will wait for another resource to be selected until we have 10 available questions in the pool. But we dont communicate this in any way, and I think for the question replacement workflow is a little more confusing because the users never see the questions number input because we dont open the modal in the settings page.

@nucleogenesis nucleogenesis self-assigned this Mar 11, 2025
@pcenov
Copy link
Member

pcenov commented Mar 11, 2025

Thanks @AlexVelezLl - I confirm that 1 is fixed now.
3 is partially fixed because there is still no snackbar message informing the user that the replacement was successful.

I was also able to identify the following issues:
6. For some reason the "Search" button is not working so we can't test the replacement of a question found by searching for it.
7. When in manual selection mode the link "N questions selected" brings the user to a page where the user can essentially do the same as on the previous page with the addition of the delete icon - so this should probably also be further discussed:

nquestionselected.mp4

@AlexVelezLl
Copy link
Member Author

AlexVelezLl commented Mar 12, 2025

Hi @pcenov! Now I have fixed all the poings but 6 and 7. 6 is still in development Not anymore :) you can now click on the search button, and 7 is the expected behaviour for now.

Point 2 has been solved by setting a the max amount of questions to select equals to the number of questions being replaced, and we have added again the "replace" button in the bulk toolbar.

For point 5, now the user dont have a way to switch to random selection, so this shouldnt happen anymore in questions replacement :)

@AlexVelezLl AlexVelezLl force-pushed the questions-replacement branch from ca7acec to 821d1e1 Compare March 12, 2025 19:40
@AlexVelezLl AlexVelezLl force-pushed the questions-replacement branch from 821d1e1 to 806a208 Compare March 12, 2025 20:04
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants