-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow comparison of instructor answers
- Add new column in db to mark if the answer is comparable - Allow students to compare instructor answers - Modify Participation Report for Research Teams to include instructors/TAs. Dispaly rank and score. Handle multiple answers from same user. - Hide user info of answers from Comparison API calls - Hide answer scores from Comparison API calls - Add new API endpoint /api/courses/:course_id/users/instructionals to retrieve instructors/TAs of the course
- Loading branch information
Showing
24 changed files
with
668 additions
and
160 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
alembic/versions/2561c39ac4d9_allow_instructor_answers_to_be_included_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
"""Allow instructor answers to be included in comparisons | ||
Revision ID: 2561c39ac4d9 | ||
Revises: f6145781f130 | ||
Create Date: 2017-12-06 21:07:23.219244 | ||
""" | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = '2561c39ac4d9' | ||
down_revision = 'f6145781f130' | ||
|
||
from alembic import op | ||
import sqlalchemy as sa | ||
from sqlalchemy.sql import text | ||
|
||
from compair.models import convention | ||
|
||
def upgrade(): | ||
# add a new "comparable" column. default as true | ||
with op.batch_alter_table('answer', naming_convention=convention) as batch_op: | ||
batch_op.add_column(sa.Column('comparable', sa.Integer(), nullable=False, default='1', server_default='1')) | ||
|
||
# Patch existing answers from instructors and TAs as non-comparable. | ||
# Note that existing answers from sys admin are considered comparable (i.e. no need to patch). | ||
# sqlite doesn't support in-clause with multiple columns... | ||
# update = text( | ||
# "UPDATE answer SET comparable = 0 " | ||
# "WHERE (assignment_id, user_id) IN ( " | ||
# " SELECT a.id, uc.user_id " | ||
# " FROM user_course uc " | ||
# " JOIN assignment a " | ||
# " ON a.course_id = uc.course_id " | ||
# " WHERE uc.course_role IN ('Instructor', 'Teaching Assistant'))" | ||
# ) | ||
# ... use a potentially slower query | ||
update = text( | ||
"UPDATE answer SET comparable = 0 " | ||
"WHERE EXISTS ( " | ||
" SELECT 1 " | ||
" FROM user_course " | ||
" JOIN assignment " | ||
" ON assignment.course_id = user_course.course_id " | ||
" WHERE " | ||
" assignment.id = answer.assignment_id " | ||
" AND user_course.user_id = answer.user_id " | ||
" AND user_course.course_role IN ('Instructor', 'Teaching Assistant'))" | ||
) | ||
op.get_bind().execute(update) | ||
|
||
def downgrade(): | ||
with op.batch_alter_table('answer', naming_convention=convention) as batch_op: | ||
batch_op.drop_column('comparable') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.