Skip to content

ubc/webworkcal

Repository files navigation

WeBWorKCal

A simple script to grab the future assignments and due dates to put them on to Google calendar for WeBWorK. Sometimes the administrator would like to know when the assignments will due and how many students in the class. So that the administrator can prepare the server for the high load. There might be some other use cases. Please let me know if you find it useful.

This script will create an event on the Google calendar and using student count, course name, assignment name as event summary and due date as the event start/end date. The summary looks like:

STUDENT_COUNT-COURSE_NAME-ASSIGNMENT_NAME

If the event is already on the calendar, the script will try to update it if the due date or student count is different.

Requirements

Installation

  1. Follow the instruction on Google API site to create a service account and download the json key file. Place the file in the same directory as updateCalendar.php.

  2. Create a new calendar or use existing one

  3. Grant your service account read/write access to your Google calendar

    • Go to Google calendar and select the calendar you want to share with service account
    • Select "Share this Calendar"
    • Add your service account email address to person text field
    • Change the Permission Settings to "Make changes to events"
    • Click "Add Person"
  4. Make a copy of config.ini.sample to config.ini

  5. Change the values inside config.ini

  6. Update your php.ini to add timezone so that it matches your timezone settings on the database server

  7. Load the MySQL Procedure

     mysql -u USERNAME -p DATABASE_NAME < assignmentDueProcedure.sql
    
  8. Run

     php updateCalendar.php
    
  9. Optionally, create a cron job for automatic update.

Docker

docker run --rm -v service-account.json:/app/service-account.json -e CALENDAR=xxx -e DB_HOST=xxx -e DB_PORT=3306 -e DB_USER=webwork -e DB_PASSWORD=xxx -e DB_NAME=webwork webworkcal

Developer Notes

  • The MySQL procedure uses dynamic table names and collecting data from those tables.
  • The script uses Google Calendar API with service account.
  • I didn't find a lot of documentations on those two topics, so this can be used as a reference.

About

WeBWorK Assignment Calendar

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published