DalOpenSource / Marker

Automatic Marking System for University Courses.
3 stars 2 forks source link

Role Relationship #1

Open andreykul opened 9 years ago

andreykul commented 9 years ago

Story

User has a role in a course

In order to know what to show to a user in a course I want to add a role relationship between a user and a course

Scenario 1

Given Bob is a student in the CSCI1100 course. When Bob goes to the CSCI1100 course home page. Then He sees grades in the side bar

Scenario 2

Given Alice is a marker for CSCI1100 course And 5 labs have been assigned to her When Alice goes to the CSCI1100 course home page. Then She sees 5 labs(s) remaining to mark

Scenario 3

Given Charlie is an instructor for the CSCI1100 course. And there are 76 submission for Assignment 1. When Charlie goes to the CSCI1100 course home page. Then He sees 76 assignment[s) have been submitted for Assignment 1

andreykul commented 9 years ago

Solved by #3

andreykul commented 9 years ago

Modified criteria. Need to remove all code and rewrite it.

AlexSafatli commented 9 years ago

What do you think of a Single Table Inheritance from User?

AlexSafatli commented 9 years ago

Going to be trying to model this using an Assignment table where:

andreykul commented 9 years ago

Don't use an Assignment since it will be used as part of a course.

In other words Assignments and Labs.

andreykul commented 9 years ago

Also by your description it is no different from a role that we had before. The only difference is that now you might not need multiple assignments between a user and a course . Like you said before it can serve as a permissions table.

AlexSafatli commented 9 years ago

You're right. It's not that different. But the STI will probably not work, either since a User might not just be a User.

What did we decide upon on Mon? I don't quite remember.

andreykul commented 9 years ago

We decided on Monday to use the three relationships as described in the issue.

But tell you what, let's do AB testing:

You implement A. I implement B.

We will meet on Monday and compare the two. What do you think?

AlexSafatli commented 9 years ago

Sounds good.

AlexSafatli commented 9 years ago

Refer to branch dev-issue1 of my AlexSafatli/Marker fork for my Permissions table implementation.

As a case study, I created a user u and a course c. To determine u's permissions for course c, the following command would have to be performed.

c_permissions = u.permissions.where(course: c)

or

c_permissions = u.permissions.find_by_course(c)

To see if u can see the marks for that course,

c_permissions.marks

To facilitate a clearer syntax, we could establish a method in the User model that does this implicitly.

andreykul commented 9 years ago

Permissions doesn't make too much sense since they are overlays of each other.

Modified original post.