Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added is_private field to Review Response table #1152

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
4 changes: 3 additions & 1 deletion api/app/reviews/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,14 @@ def post(self):
scores = args['scores']
language = args['language']
is_submitted = args['is_submitted']
# is_private = args['is_private']

response_reviewer = review_repository.get_response_reviewer(response_id, reviewer_user_id)
if response_reviewer is None:
return FORBIDDEN

review_response = ReviewResponse(review_form_id, reviewer_user_id, response_id, language)
# review_response = ReviewResponse(review_form_id, reviewer_user_id, response_id, language, is_private)
review_response = ReviewResponse(review_form_id, reviewer_user_id, response_id, language, True)
lucas-meyer-7 marked this conversation as resolved.
Show resolved Hide resolved
review_response.review_scores = self.get_review_scores(scores)
if is_submitted:
review_response.submit()
Expand Down
5 changes: 4 additions & 1 deletion api/app/reviews/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ class ReviewResponse(db.Model):
language = db.Column(db.String(2), nullable=False)
is_submitted = db.Column(db.Boolean(), nullable=False)
submitted_timestamp = db.Column(db.DateTime(), nullable=True)
is_private = db.Column(db.Boolean(), nullable=False)

review_form = db.relationship('ReviewForm', foreign_keys=[review_form_id])
reviewer_user = db.relationship('AppUser', foreign_keys=[reviewer_user_id])
Expand All @@ -207,12 +208,14 @@ def __init__(self,
review_form_id,
reviewer_user_id,
response_id,
language):
language,
is_private):
self.review_form_id = review_form_id
self.reviewer_user_id = reviewer_user_id
self.response_id = response_id
self.language = language
self.is_submitted = False
self.is_private = is_private

def submit(self):
self.is_submitted = True
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Adds a field called ``is_private`` to review_response table.
It is used to specify whether the response from the reviewer is public,
or private. If it is private, then only the meta-reviewer can see the response.

Revision ID: e23b638b03cc
Revises: 9143756e596d
Create Date: 2023-07-30 19:16:28.509240

"""

# revision identifiers, used by Alembic.
revision = 'e23b638b03cc'
down_revision = '9143756e596d'

from alembic import op
import sqlalchemy as sa

def upgrade():
op.add_column('review_response', sa.Column('is_private', sa.Boolean(), nullable=False))
lucas-meyer-7 marked this conversation as resolved.
Show resolved Hide resolved

def downgrade():
op.drop_column('review_response', 'is_private')