You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
YAY ADMIN ENROLLING STUDENTS IN CLASSES!
We want admin users to have the ability to enroll students in classes just in case there are technical difficulties. Log into the admin account (find the account with the privilege field set to “admin” in the Mongo users collection), which will take you to the admin page. On the admin page (AdminView.jsx), add a section containing a form with two input fields. The first should get the student’s email and the second should be the ID of the class (which will be the class’s MongoDB ID). When the form is submitted, the student should now be enrolled in the class! Make sure that the form can only be submitted when all the fields are filled out.
To make your life easier, most of this ticket should be done using pre-existing components and endpoints like the form components and enrollment endpoints. Note that the enrollment endpoint takes a student’s MongoDB ID and not their email, so you will need to first fetch the student object from the database given the email then get the student ID from that (you can use the getUser() function for this!) We also want to make sure that only students can be enrolled in classes, so if the student ID doesn’t belong to a student send an error message!
Acceptance Criteria:
Did you link the ticket/issue number with your branch using the pull request template?
When the form is submitted with the required information, does the student’s enrolledClasses array contain the new class’s MongoDB ObjectID in the database?
Does the student’s ID also update in the class’s roster array?
Task Description:
YAY ADMIN ENROLLING STUDENTS IN CLASSES!
We want admin users to have the ability to enroll students in classes just in case there are technical difficulties. Log into the admin account (find the account with the privilege field set to “admin” in the Mongo users collection), which will take you to the admin page. On the admin page (AdminView.jsx), add a section containing a form with two input fields. The first should get the student’s email and the second should be the ID of the class (which will be the class’s MongoDB ID). When the form is submitted, the student should now be enrolled in the class! Make sure that the form can only be submitted when all the fields are filled out.
To make your life easier, most of this ticket should be done using pre-existing components and endpoints like the form components and enrollment endpoints. Note that the enrollment endpoint takes a student’s MongoDB ID and not their email, so you will need to first fetch the student object from the database given the email then get the student ID from that (you can use the
getUser()
function for this!) We also want to make sure that only students can be enrolled in classes, so if the student ID doesn’t belong to a student send an error message!Acceptance Criteria:
References and Resources:
MongoDB collection commands: https://www.mongodb.com/docs/manual/reference/method/js-collection/
Mongo Updating Documents: https://www.mongodb.com/docs/manual/tutorial/update-documents/
The text was updated successfully, but these errors were encountered: