Skip to content
Snippets Groups Projects
Unverified Commit faad381d authored by Todd Dembrey's avatar Todd Dembrey Committed by GitHub
Browse files

Merge pull request #1046 from OpenTechFund/feature/989-reviewer-dash-consensus

Feature/989 reviewer dash consensus
parents 0934c53c 8209b69f
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ from opentech.apply.funds.tests.factories import (
ApplicationRevisionFactory,
InvitedToProposalFactory,
)
from opentech.apply.review.tests.factories import ReviewFactory, ReviewOpinionFactory
from opentech.apply.users.tests.factories import UserFactory, ReviewerFactory, StaffFactory
from opentech.apply.utils.testing.tests import BaseViewTestCase
......@@ -69,6 +70,16 @@ class TestStaffDashboard(BaseViewTestCase):
self.assertContains(response, submission.title)
self.assertEquals(response.context['in_review_count'], 1)
def test_waiting_for_review_after_agreement_is_empty(self):
staff = StaffFactory()
submission = ApplicationSubmissionFactory(status='external_review', workflow_stages=2, reviewers=[staff, self.user])
review = ReviewFactory(submission=submission, author=staff, recommendation_yes=True)
ReviewOpinionFactory(review=review, author=self.user, opinion_agree=True)
response = self.get_page()
self.assertContains(response, 'Waiting for your review')
self.assertContains(response, "Nice! You're all caught up.")
self.assertEquals(response.context['in_review_count'], 0)
class TestReviewerDashboard(BaseViewTestCase):
user_factory = ReviewerFactory
......
......@@ -21,6 +21,7 @@ from wagtail.contrib.forms.models import AbstractFormSubmission
from opentech.apply.activity.messaging import messenger, MESSAGES
from opentech.apply.determinations.models import Determination
from opentech.apply.review.options import AGREE
from opentech.apply.stream_forms.blocks import UploadableMediaBlock
from opentech.apply.stream_forms.files import StreamFieldDataEncoder
from opentech.apply.stream_forms.models import BaseStreamForm
......@@ -86,6 +87,8 @@ class ApplicationSubmissionQueryset(JSONOrderable):
qs = self.filter(Q(status__in=user_review_statuses), ~Q(reviews__author=user) | Q(reviews__is_draft=True))
if assigned:
qs = qs.filter(reviewers=user)
# If this user has agreed with a review, then they have reviewed this submission already
qs = qs.exclude(reviews__opinions__opinion=AGREE, reviews__opinions__author=user)
return qs.distinct()
def reviewed_by(self, user):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment