nasonfish / derp

Development Experience Reporting Platform
0 stars 3 forks source link

professor foreign key in course table, or as enrollment? #11

Closed nasonfish closed 5 years ago

nasonfish commented 5 years ago

Two options:

Course(
id,
name,
...
professor_fk REFERENCES account.user_pk
)

OR

Course(
id,
name,
...
)

Enrollment(
user_fk,
course_fk,
role -- 'professor' or 'student' or other options
)

option 1 lets us do simpler queries for course information. option 2 allows for multiple professors and other kinds of flexibility around the "professor" role.

dellswor commented 5 years ago

I think ultimately you'll end up wanting option 2... Many institutions have team taught courses and placing the role into the enrollment will allow the same mechanism to be used for multiple types of roles (e.g. graders).

nasonfish commented 5 years ago

Ah, great! That's what I ended up doing.

https://github.com/nasonfish/derp/blob/master/src/derp/db_helper.py#L332

Thinking back on it, I'm not sure why I was ever considering the first one. I saw it as less queries/less complex joins (which don't really matter all that much), but it's at the expense of co-taught classes, giving graders/paraprofs permissions in specific classes, etc.

Thanks for your comment!