-
Notifications
You must be signed in to change notification settings - Fork 0
sessionQuestion
This documents a lot of Firebase functions present in the file sessionQuestion.ts, which is a central place for a lot of functions that deal with Firebase related to the questions within a specific office hour session.
This file's functions are primarily imported for the SessionQuestion.tsx component, which is the component for each question within a session.
- db: firebase.firestore.Firestore -> The Firestore interface to interact with Firebase
- user: FireUser -> The user whose location is being updated (FireUser contains properties that match a user document in the users collection in the Firestore database)
- session: FireSession -> The office hours session
- virtualLocation -> The string containing at which link students can enter your office hour (e.g. your zoom link)
What it does functionally: This has to do with the zoom link section for a virtual office hour, and it is relevant for TAs/professors. When you add a link for your office hour for students to join at, this function is used to update your virtual location in Firebase so students can join the link on their side.
What it exactly does to the Firebase: This adds or modifies the profiles collection within the office hour session document by adding or modifying the profile document within this collection with the attribute virtualLocation containing the string of the URL of your office hours (e.g. your Zoom link).
- user: firebase.User | null -> a user account for the Firebase
- session: FireSession -> The office hours session
- db: firebase.firestore.Firestore -> The Firestore interface to interact with Firebase
- location: string -> The location that the student inputs, which is the value in the field for "Location or Zoom Link" when a student adds a question
- selectedPrimary: FireTag | undefined -> The primary tag that was selected to describe the question (i.e. the category from "Select a Category" when a student adds a question)
- selectedSecondary: FireTag | undefined -> The secondary tag that was selected to describe the question (i.e. the tag from "Select a Tag" when a student adds a question)
- question: string -> The content of the question itself
Returns: a boolean, which returns true if the user is not null and false otherwise, which lets us know if the user was null which means adding the question didn't work
What it does functionally: This function is called whenever a student adds a question to the queue. It is filled in with the relevant information that is provided by the student when he or she asks the question, including the question's content, category selected, etc.
What it exactly does to the Firebase: This adds the question document to both the questionSlots and questions collection. The questionSlots collection is similar to the question collection, except that it is a more concise version of it.
- db: firebase.firestore.Firestore -> The Firestore interface to interact with Firebase
- question: FireOHQuestion -> The question, which has the properties that the question document has on the Firestore
What it does functionally: This function is called when a TA or professor the student as No Show for the question.
What it exactly does to the Firebase: This updates the question document in both the questionSlots and questions collections with the new property of status: 'no-show'.
- db: firebase.firestore.Firestore -> The Firestore interface to interact with Firebase
- question: FireOHQuestion -> The question, which has the properties that the question document has on the Firestore
What it does functionally: This function is called when a TA or professor the student as Done for the question.
What it exactly does to the Firebase: This updates the question document in both the questionSlots and questions collections with the new property of status: 'resolved'.
- db: firebase.firestore.Firestore -> The Firestore interface to interact with Firebase
- question: FireOHQuestion -> The question, which has the properties that the question document has on the Firestore
What it does functionally: This function is called when a TA or professor the student goes to the three dots on the right and clicks "I really don't know," which unassigns the TA or professor from that question so someone else can handle the question.
What it exactly does to the Firebase: This updates the question document in both the questionSlots and questions collections with the new property of status: 'unresolved'.
- db: firebase.firestore.Firestore -> The Firestore interface to interact with Firebase
- question: FireOHQuestion -> The question, which has the properties that the question document has on the Firestore
What it does functionally: This function is currently not in use, and the removeQuestionByID function (see below) with similar function is used instead. This function is supposed to be called when a student clicks on "Remove" for his or her question and proceeds to remove his or her question from the queue.
What it exactly does to the Firebase: This updates the question document in both the questionSlots and questions collections with the new property of status: 'retracted'.
- db: firebase.firestore.Firestore -> The Firestore interface to interact with Firebase
- question: FireOHQuestion -> The question, which has the properties that the question document has on the Firestore
- newComment: string -> The content of the new comment
- isTA: boolean -> Is true if the user is a TA or professor for that course in which the question was asked
What it does functionally: Whenever a TA or student makes a comment by opening the comment box with the comment icon and later clicks edit to update that comment, this function is called to update the content of that comment.
What it exactly does to the Firebase: This updates the studentComment or taComment property of the question document based on whether it was a TA or a student making the comment.
- db: firebase.firestore.Firestore -> The Firestore interface to interact with Firebase
- question: FireOHQuestion -> The question, which has the properties that the question document has on the Firestore
- virtualLocation: string | undefined -> The string containing at which link students can enter your office hour (e.g. your zoom link)
- myUserId: string -> The string containing the user id of the TA who just got assigned to the question at hand
What it does functionally: This function is called to handle whenever a student's question is assigned to the TA.
What it exactly does to the Firebase: This updates a lot of properties for the question document that just got assigned, including setting the status to 'assigned', setting the answererId to the TA's userId, setting the timeAssigned to the current time, and setting the virtualLocation to the answerer's location, if it was provided.
- db: firebase.firestore.Firestore -> The Firestore interface to interact with Firebase
- removeQuestionId: string | undefined -> The ID of the question to be removed
What it does functionally: This function is called whenever a student removes his or her question from the queue.
What it exactly does to the Firebase: This updates the relevant question document specified by the removeQuestionId by setting the question's status to 'retracted'.
- db: firebase.firestore.Firestore -> The Firestore interface to interact with Firebase
- virtualLocation: string -> The string containing at which link students can enter your office hour (e.g. your zoom link)
- questions: readonly FireQuestion[] -> The array of questions in the session
- user: FireUser -> The TA who answered the question
What it does functionally: This function is called whenever a TA's virtual location changes to update all the virtual location properties of questions that were asked which were already assigned to that TA (note that it says assigned, which means it excludes already resolved questions, for instance).
What it exactly does to the Firebase: This updates the relevant question documents within the questions collection in the session with the new virtual location of the TA.