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

Quiz editing capability for not yet activated quizzes #12232

Merged
merged 19 commits into from
Jun 5, 2024

Conversation

rtibbles
Copy link
Member

@rtibbles rtibbles commented Jun 3, 2024

Summary

Backend tech debt/cleanup:

  • Adds a limit kwarg to the serialize method to allow the queryset to be sliced after annotation but before a DB fetch has occurred - this probably shouldn't affect most uses of serialize object, but is added as it is useful for changes made here.
  • Updates the lesson endpoint to return (active, assignments) rather than (is_active, lesson_assignments) to be parallel to the exam endpoint
  • Update the class summary API endpoint to reuse the exam and lesson endpoints to avoid subtle differences between the two (leave the additional 'groups' processing for now)

Frontend tech debt/cleanup:

  • Does some cleanup of the useQuizCreation composable to stop provide/injecting unused items.
  • Removes the endlessly repeated authorization props for the CoachAppBar and CoachImmersive pages, and instead just reads the values directly from the store.
  • Update the frontend to use lesson.active instead of lesson.is_active
  • Update the frontend to always use lesson.assignments (regardless of whether reading from the lessons API or the class summary data)
  • Update the data helpers getters to work with the simplifications to data representation for exams and lessons
  • Refactor the AssignmentDetailsModal to make its appearance parallel to the new title editing for quizzes and simplify the API to just accept an assignment object (leveraging the parallel data representation for exams and lessons).
  • Remove unneeded slot that further complicated the API, and hide the bottom app bar when editing quizzes, instead making it expose an update event to allow it to be used more like a two way data binding component
  • Fixes regression caused by an unreferenced usage of the common coach strings mixin
  • Updates the CoachExamPage to use composables
  • Cleans up unused components, routes, and vuex state after the feature work

Backend feature work:

  • Adds a new DraftExam model to store data about Exams that are not ready to be synced yet.
  • Updates the API endpoint for the Exam model to handle both models, returning data for both in fetches, and flexibly updating the models depending on whether the exam is or is not now in draft
  • Adds extensive API endpoint tests to cover the different cases

Frontend feature work:

  • Update the quiz creation experience to allow it to handle editing of existing quizzes - if the quiz is a draft, it allows total editing, otherwise just the title and assignments.
  • Updates CoachExamPage to undraft draft quizzes when activating them
  • Updates the quiz creation workflow to allow assignment of the quizzes when they are being created, using the updated AssignmentDetailsModal component
  • Update all places where a quiz is edited (e.g. the 'edit details' flow) to use the new creation flow for a consistent editing experience
  • Updates the copy workflow to work with the updated backend

References

Fixes #12150
Handles some aspects of #11615 inasmuch as it deletes all the vuex state specific to this route, and switches to composables

Reviewer guidance

Create a quiz.
Edit the quiz before activating.
Activate the quiz.
Edit after activation.
Copy quiz.
Edit a copied quiz.


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: Learn Re: Learn App (content, quizzes, lessons, etc.) APP: Coach Re: Coach App (lessons, quizzes, groups, reports, etc.) DEV: frontend DEV: tools Internal tooling for development SIZE: very large labels Jun 3, 2024
@rtibbles rtibbles changed the title Quiz edito Quiz editing capability for not yet activated quizzes Jun 3, 2024
@marcellamaki
Copy link
Member

A few follow up items as discussed during the code review walk through (hopefully comprehensible reminders to Richard):

  • There is an edge case in regards to the created date for Exams that are created via the API endpoint that should be handled
  • Is limit=1 necessary?
  • Add code comments, particularly in the serializers, although really throughout commit a2503ab` would be helpful to add additional details and reasoning
  • objectWithDefaults check does not have to happen twice
  • At some point we discussed updating to attrs.get("active") which seems like it would have been in a serializer but now I cannot find the line in the diff.

@rtibbles
Copy link
Member Author

rtibbles commented Jun 4, 2024

Hopefully I've addressed all the issues we identified @nucleogenesis @marcellamaki - I did a rebase, so as to keep the diff clean and drop the unneeded commit.

@pcenov
Copy link
Member

pcenov commented Jun 4, 2024

Hi @rtibbles it's not possible to save a quiz - I'm getting a 500 server error when I attempt to do so:

2024-06-04_12-39-32.mp4

Logs: Logs.zip

@rtibbles
Copy link
Member Author

rtibbles commented Jun 4, 2024

Ah yes, this is the result of my updating things based on yesterday's code review, and then only testing the editing flow, not the creation flow, afterwards!

Remove cruft from serializers left over from when they weren't write only.
Defer as many fields as possible to backend data handling.
…and quiz data.

Remove use of 'this' and refer to 'getters' to avoid an implicit coupling with the commonCoach mixin.
… a form)

To simplify API and allow usage as an input component.
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.

✅ Code review

I'll leave PR approval until QA has given it a pass. Once we're cleared of regressions we'll merge this.

@pcenov
Copy link
Member

pcenov commented Jun 5, 2024

Hi @rtibbles, here are the issues I able to identify:

  1. When creating/editing a quiz, clicking the Save button results in immediately closing the modal:
Clicking.Save.closes.the.quiz.mp4
  1. When editing a quiz I cannot replace a question because clicking the checkbox of a question results in selecting all the questions:
Cannot.replace.questions.mp4
  1. Cannot edit the title of a started quiz - getting a 404 error:
started.quiz.mp4
  1. 'Select a quiz' is not working, getting a TypeError: Cannot read properties of undefined (reading 'data'):
select.a.quiz.mp4
  1. When editing a quiz the 'Question order' value is always displayed as 'Randomized'. Note that it's not clear what should happen if I have both sections with randomized and fixed order:
Question.order.mp4

@rtibbles
Copy link
Member Author

rtibbles commented Jun 5, 2024

Hi @pcenov - thanks for this review, only 3 is directly related to the changes here, so I'll address that within the scope of this PR, but leave the others for follow up, as they are pre-existing to my work here.

@radinamatic
Copy link
Member

I did not do such an extensive testing as @pcenov , but I can replicate 2. (replacing a question does not work because clicking the checkbox of a question results in selecting all the questions), which got me into a 400 error:

400-patch

Limit patch updates to only things we need/are allowed to update.
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.

Blocking changes have been addressed, good to merge once follow-ups are made! Thanks Richard

@nucleogenesis
Copy link
Member

@rtibbles @radinamatic I've tested this locally and the code LGTM

@rtibbles
Copy link
Member Author

rtibbles commented Jun 5, 2024

@radinamatic @nucleogenesis confirmed the fix of the final issue of activating a quiz from the summary page, we're going to merge here to keep development going, and we're confident of the fix.

@rtibbles rtibbles merged commit e53c58e into learningequality:develop Jun 5, 2024
31 checks passed
@rtibbles rtibbles deleted the quiz_edito branch June 5, 2024 20:24
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: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: backend Python, databases, networking, filesystem... DEV: frontend DEV: tools Internal tooling for development SIZE: very large
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow coaches to edit non-assigned quizzes.
5 participants