penn-courses icon indicating copy to clipboard operation
penn-courses copied to clipboard

Add ICS export functionality to PCP

Open rohangpta opened this issue 2 years ago • 1 comments

BEFORE MERGING: Discard changes to

  • settings/development.py
  • docker-compose.yaml

This PR provides an API under Penn Course Plan, at /api/plan/schedules/<schedule_pk>/calendar/<user_secretuuid> which will export the schedule with pk = schedule_pk for user with uuid_secret = user_secretuuid as an ICS file.

We add the uuid field to users since we do not want to expose user PKs over the network.

We use the ICS python module to do this, alongside Arrow for easy datetime conversions.

None of this functionality is tested (I had trouble setting up local dev environment) and probably contains minor bugs.

rohangpta avatar Jan 15 '23 16:01 rohangpta

@AaDalal @mureytasroc any chance I can ask one of you to go over this PR? Failing some documentation test case and unsure what I need to do to fix, PCX documentation test cases are different from Clubs'

A couple notes:

  • makemigrations migrated a new field on NGSS. Was this field unmigrated the whole time?
  • I installed psycopg2-binary due to this: https://stackoverflow.com/questions/52770689/psycopg2-error-symbol-not-found-pqbackendpid. Should be harmless.
  • Installing new packages led to all packages updating. Let me know if this is undesirable, and will make sure to rerun installs with --keep-outdated.
  • How come the Meeting model has fields like start_date, room, end_date, I would have assumed these wld be properties of Section, since they are duplicated across Meeting instances. Maybe this is not true in general? The ICS parsing definitely assumes so.

rohangpta avatar Jan 15 '23 19:01 rohangpta