Flubaroo Code Architecture
The code is split out into a number of files:
The latest code can be viewed here. Each file contains a description at the top of what it's for.
Flubaroo Object Architecture
Flubaroo must read and write to 2 different sheets:
- "Student Submissions"
- Read from when grading, to pull all student info and submission values.
- Read from when grading, to record:
- Which students have already received their email.
- How many times each student has submitted already.
- What individual feedback has been recorded for each student.
- Written to when:
To abstract spreadsheet details, and make the above tasks easy to accomplish and modify, Flubaroo implements the object-oriented classes and methods outlined below:
- Obfuscates how data is stored in, accessed from, and written to the "Grades" sheet, both during grading and after. This saves the programmer from dealing with column and row logic, which can get confusing.
- Only one instance ever created at a time.
- Maintains an array of GradedSubmission objects,
- The array is indexed by a hash of a submission's student identifiers (aka "fingerprint").
- Has method to read and process the "Student Submissions" sheet (during grading)
- Has method to output the Grades sheet (after grading completes).
- Has methods to read in and process Grades sheet (at start of grading, to check things like "Already Emailed?")
- Can be initialized in one of several ways, depending on the action needed:
- INIT_TYPE_SUBM: Initializes from "Student Submissions" sheet. Used for grading submissions.
- INIT_TYPE_GRADED_FULL: Initializes from "Grades" sheet. Reads in everything there. Used when emailing grades.
- INIT_TYPE_GRADED_PARTIAL: Initializes from "Grades" sheet, but doesn't read in copy of original student submissions (in hidden rows at bottom of sheet). Used for checking things like "Already Emailed?" column, when re-grading.
- INIT_TYPE_GRADED_META: Reads in a limited amount of data from the "Grades" sheet, including just the first row of grades. Used when some basic info is needed for generating UIs.
- Contains information on a single student submission made in the Student Submissions sheet, and the grades it has (or will be) assigned. This includes:
- Text of all questions asked
- The student's responses to all of the questions.
- Help tips for each question (if provided)
- Grading options that apply to each question
- Answer key values, used to grade each question.
- Row number in which the submission resides.
- The score earned for each question (number of points). This is initialized either during grading, or from the Grades sheet, depending on how the GradedWorksheet was initialized.
- Has a method to perform the grading, assigning scores to each question.
- Has methods to iterate over all questions asked, returning all of the relevant information for each (question, text, student's response, score, etc).
- Has method to generate a "fingerprint" for the submission, which is a hash of all student identifiers. This is used to identify students who have submitted more than once.
- Has a method to convert specific data info a row that can be written to the Grades sheet (examples: output a row of graded values, output the row of question summaries used at the top).
- Contains information for a single question in a GradedSubmission. This includes:
- Text of the question
- Text of the student's response.
- Answer key value for this question.
- Grading option for this question.
- Score (in points) earned for this question
- The help tip for this question, if present.
- Has methods to set and get all of these values.
Example of How Classes are Used:
Here's some code showing how these classes might be used to iterate through all submissions, and log the student's response to each question. Other examples can be found in the code quite easily by searching for "getFirstGradedSubmission" and "getFirstQuestion".
// read in the "Student Submissions" sheet
ss = SpreadsheetApp.getActiveSpreadsheet();
var gws = new GradesWorksheet(ss, INIT_TYPE_SUBM);
// loop through all submissions in the sheet
for (var graded_subm = gws.getFirstGradedSubmission();
graded_subm != null;
graded_subm = gws.getNextGradedSubmission());
for (var ques = graded_subm.getFirstQuestion();
ques != null;
ques = graded_subm.getNextQuestion());
var ques_val = ques.getFullQuestionText();
var subm_val = ques.getFullSubmissionText();
Logger.log("question: " + ques_val);
Logger.log("submission: " + subm_val);