Tuesday, October 15, 2013

Triggers + Doctopus = An almost success.

Problem: My students are in the drafting process of a major paper, and they have a deadline tonight at 11:59 p.m.

I created the assignment via Doctopus, an +Andrew Stillman script.

Because this is a hard deadline (as opposed to the final deadline, when I'll accept late "submissions"), I'm using the Embargo function to change students' permissions to View Only (effectively preventing a student on working on the paper after the deadline).

The problem, of course, is that I don't want to be up at 11:59 p.m. to run the Embargo function from the menu.

What I tried: Google Script triggers

From the Doctopus assignment spreadsheet, click on Tools - Script editor...

Click on Resources from the script editor page, and click on Current project's triggers

Click on Add a new trigger

For the box under Run, choose embargo

Under Events, choose Time-driven

In my use case, I wanted to close access at midnight, so I chose Specific date and time in the next box, and specified the time in the format indicated.

Click Save.

That's it. At the specified date and time, the trigger will run the embargo function, and I can stay in bed.

However... (if you want to skip the technical details, scroll down to Workaround)

The problem:

I tested this on another assignment, and it runs with one hitch.

After embargo() runs via trigger, the Doctopus menu shows "Embargo for grading:" only, stripping the "Set editors for view only".

At first I thought the problem was only cosmetic, as refreshing the spreadsheet will show the option to Unembargo. I ran it, thought it was a success, and then checked a student's document.

Nope. They only had view privileges.

What seems to get lost somewhere in the process is the ScriptProperty variable groupPrivileges (the role you give students in Step 1: allow edit, allow view only, or allow comment only) gets lost, hence the menu.

So running unembargo doesn't actually do anything. It did actually kick out an error message, but I didn't catch it. I don't know if I tried to check the Execution transcript too much after the fact, but I couldn't find it there either.

I don't have the time to figure out where and why the variable loses its value (I should be grading right now...), but thankfully, I found a simple workaround.

Workaround:

Use the Doctopus menu to return to Step 1: Set up sharing basics and save those settings as originally set.

Run Embargo and Unembargo one more time, manually, and it will restore students' editing privileges correctly.

(Of course, if you set Doctopus to send notification emails, this could get annoying for the students. Hint: Change this setting in Step 3.)

Looking ahead:

Where I originally wanted to use a time-based trigger was on the Flubaroo Script ( +Dave Abouav , +edCode.org )

(Imagine keeping a practice test live, allowing students to take it whenever they want, and emailing the results back to them immediately onFormSubmit, similar to the MCQ script)

Unfortunately, that email function requires user input before sending emails, which would break the automated process.

A messy fix could be creating an almost-identical function to the existing function, except hard coding the user input variables in there. This, though, stinks for scalability reasons and probably other reasons that coders would know about.

If someone doesn't figure it out by the summer, I guess I have one project lined up.

But I'm an English teacher, and I really need to get back to grading.

No comments:

Post a Comment