Last active
April 5, 2021 22:41
-
-
Save barrieroberts/a1538f343c3c0edf99cb961bef7356f6 to your computer and use it in GitHub Desktop.
Assignment Maker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//CHAPTER 1 - Bound to a Google Form | |
function assignmentMaker(e) { | |
//Get latest form response (teacher, group, assignment) | |
var itemResponses = e.response.getItemResponses(); | |
var teacher = itemResponses[0].getResponse(); | |
var group = itemResponses[1].getResponse(); | |
var assignment = itemResponses[2].getResponse(); | |
//Get task for assignment selected | |
var assignments = ["Assignment #1", | |
"Assignment #2", | |
"Assignment #3"]; | |
var tasks = ["Write about your last holiday.", | |
"Write a review of a film you watched recently.", | |
"Write a proposal for a new shop in your town."]; | |
var position = assignments.indexOf(assignment); | |
var task = tasks[position]; | |
//Create G Doc in My Drive, get body & append paragraphs | |
var doc = DocumentApp.create(assignment); | |
var body = doc.getBody(); | |
body.appendParagraph("Teacher: " + teacher); | |
body.appendParagraph("Group: " + group); | |
body.appendParagraph(task); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment