diff --git a/opentech/apply/activity/migrations/0015_partner_field_event.py b/opentech/apply/activity/migrations/0015_partner_field_event.py deleted file mode 100644 index 0bc4c4b05e4eaf43852a0065e102cd08baf883ba..0000000000000000000000000000000000000000 --- a/opentech/apply/activity/migrations/0015_partner_field_event.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.0.10 on 2019-02-20 12:40 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('activity', '0014_add_batch_reviewer_message'), - ] - - operations = [ - migrations.AlterField( - model_name='event', - name='type', - field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission')], max_length=50), - ), - ] diff --git a/opentech/apply/activity/migrations/0019_partner_field_event.py b/opentech/apply/activity/migrations/0019_partner_field_event.py new file mode 100644 index 0000000000000000000000000000000000000000..65dd47e142ac55ab9038d8e44ca14c9cb1c6ec01 --- /dev/null +++ b/opentech/apply/activity/migrations/0019_partner_field_event.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0.10 on 2019-02-20 12:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('activity', '0018_add_batch_determine'), + ] + + operations = [ + migrations.AlterField( + model_name='event', + name='type', + field=models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('EDIT', 'Edit'), ('APPLICANT_EDIT', 'Applicant Edit'), ('NEW_SUBMISSION', 'New Submission'), ('SCREENING', 'Screening'), ('TRANSITION', 'Transition'), ('BATCH_TRANSITION', 'Batch Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('BATCH_DETERMINATION_OUTCOME', 'Batch Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('BATCH_REVIEWERS_UPDATED', 'Batch Reviewers Updated'), ('PARTNERS_UPDATED', 'Partners Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('BATCH_READY_FOR_REVIEW', 'Batch Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission'), ('REVIEW_OPINION', 'Review Opinion')], max_length=50), + ), + ] diff --git a/opentech/apply/funds/migrations/0051_applicationsubmission_partners.py b/opentech/apply/funds/migrations/0056_applicationsubmission_partners.py similarity index 92% rename from opentech/apply/funds/migrations/0051_applicationsubmission_partners.py rename to opentech/apply/funds/migrations/0056_applicationsubmission_partners.py index b50d68de3a24b464e5940ac9b60026f0cd4f6f6f..72a7105d89d2c1a038e4d922393a20f648d66425 100644 --- a/opentech/apply/funds/migrations/0051_applicationsubmission_partners.py +++ b/opentech/apply/funds/migrations/0056_applicationsubmission_partners.py @@ -8,7 +8,7 @@ class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('funds', '0050_roundsandlabs'), + ('funds', '0055_reviewers_rename'), ] operations = [ diff --git a/opentech/apply/funds/serializers.py b/opentech/apply/funds/serializers.py index fbb72a705264cc11725b9b47464d3bf98c9da4a1..4f3640364745f041ecd37c2ef90a98d2f1375c3b 100644 --- a/opentech/apply/funds/serializers.py +++ b/opentech/apply/funds/serializers.py @@ -99,6 +99,7 @@ class ReviewSummarySerializer(serializers.Serializer): 'order': assigned.role and assigned.role.order, }, 'is_staff': assigned.reviewer.is_apply_staff, + 'is_partner': assigned.reviewer.is_partner, } for assigned in assigned_reviewers ] @@ -114,6 +115,7 @@ class ReviewSummarySerializer(serializers.Serializer): 'order': None, }, 'is_staff': user.is_apply_staff, + 'is_partner': user.is_partner, } for user in User.objects.filter(id__in=extra_reviewers) ]) diff --git a/opentech/apply/funds/templates/funds/applicationsubmission_reviewer_detail.html b/opentech/apply/funds/templates/funds/applicationsubmission_reviewer_detail.html index 48cb367b79cf8beca671f1984c068c484fc8363b..dcc7f795f136ac8a1ea4d5251e74896b19027655 100644 --- a/opentech/apply/funds/templates/funds/applicationsubmission_reviewer_detail.html +++ b/opentech/apply/funds/templates/funds/applicationsubmission_reviewer_detail.html @@ -5,7 +5,7 @@ <div class="sidebar__inner"> <h5>Reviews & assignees</h5> - {% include 'funds/includes/review_table.html' %} + {% include 'funds/includes/review_sidebar.html' %} <div class="wrapper wrapper--sidebar-buttons"> {% include 'review/includes/review_button.html' with submission=object class="button--half-width" %} diff --git a/opentech/apply/funds/templates/funds/includes/review_sidebar.html b/opentech/apply/funds/templates/funds/includes/review_sidebar.html index a0fe991e5a83057d635c24ce7e279855ea98e083..5db34c90f216c6bce5cc3bf853461420a2d06407 100644 --- a/opentech/apply/funds/templates/funds/includes/review_sidebar.html +++ b/opentech/apply/funds/templates/funds/includes/review_sidebar.html @@ -28,6 +28,19 @@ {% include 'funds/includes/review_sidebar_item.html' with reviewer=review_data.reviewer missing=True %} {% endfor %} + {% if reviews_block.partner_reviewed or reviews_block.partner_not_reviewed %} + <hr class="reviews-sidebar__split"> + + {% for review_data in reviews_block.partner_reviewed %} + {% include 'funds/includes/review_sidebar_item.html' with review=review_data.review reviewer=review_data.reviewer opinions=review_data.opinions %} + {% endfor %} + + {% for review_data in reviews_block.partner_not_reviewed %} + {% include 'funds/includes/review_sidebar_item.html' with reviewer=review_data.reviewer missing=True %} + {% endfor %} + + {% endif %} + {% if object.stage.has_external_review %} {% if reviews_block.external_reviewed or reviews_block.external_not_reviewed %} <hr class="reviews-sidebar__split"> diff --git a/opentech/apply/funds/tests/test_forms.py b/opentech/apply/funds/tests/test_forms.py index ebed1ef88f17eaad1222e7569d529b0d82e51707..443b84ef6bfa706d68d86e93dcb79ad76f4d0064 100644 --- a/opentech/apply/funds/tests/test_forms.py +++ b/opentech/apply/funds/tests/test_forms.py @@ -28,9 +28,10 @@ class TestReviewerFormQueries(TestCase): submission = InvitedToProposalFactory(lead=user, workflow_stages=2) # Reviewers + # Partners # Assigned Reviewers # Roles - with self.assertNumQueries(3): + with self.assertNumQueries(4): form = UpdateReviewersForm(user=user, instance=submission) # 3 x Staff - 1 per Role diff --git a/opentech/apply/review/views.py b/opentech/apply/review/views.py index 03da640b2dc085db013a6a6062fa28b5dd6d2dff..b73244785370b8f037bbb58743b6c3aa6df1bf65 100644 --- a/opentech/apply/review/views.py +++ b/opentech/apply/review/views.py @@ -52,6 +52,11 @@ class ReviewContextMixin: key = 'staff_reviewed' elif review not in opinion_authors: key = 'staff_not_reviewed' + elif reviewer.is_partner: + if review: + key = 'partner_reviewed' + elif review not in opinion_authors: + key = 'partner_not_reviewed' else: if review: key = 'external_reviewed' diff --git a/opentech/static_src/src/app/src/containers/ReviewInformation.js b/opentech/static_src/src/app/src/containers/ReviewInformation.js index 8e6a1f0d65fb2330a6eef5c3a1a3b7e31a6d0e0a..02ddf9d854ebe090bd081ae1a99f99ef13b8b973 100644 --- a/opentech/static_src/src/app/src/containers/ReviewInformation.js +++ b/opentech/static_src/src/app/src/containers/ReviewInformation.js @@ -19,7 +19,16 @@ const ReviewInformation = ({ submission }) => { const staff = []; const nonStaff = []; - Object.values(data.assigned).map(key => key.isStaff ? staff.push(key) : nonStaff.push(key)) + const partner = []; + Object.values(data.assigned).map(person => { + if (person.isStaff) { + staff.push(person) + } else if(person.is_partner){ + partner.push(person) + } else { + nonStaff.push(person) + } + }) const orderPeople = (people) => { people.sort((a,b) => { @@ -77,22 +86,38 @@ const ReviewInformation = ({ submission }) => { </> } - const [staffReviewed, staffNotReviewed] = orderPeople(staff); - const [nonStaffReviewed, nonStaffNotReviewed] = orderPeople(nonStaff); + + const renderNormal = (people) => { + const [peopleReviewed, peopleNotReviewed] = orderPeople(people); + return <> + {renderReviewBlock(peopleReviewed)} + {renderReviewBlock(peopleNotReviewed)} + </> + } + + const renderCollapsed = (people) => { + const [peopleReviewed, peopleNotReviewed] = orderPeople(people); + return <> + { renderReviewBlock(peopleReviewed) } + { peopleNotReviewed.length !== 0 && + <a onClick={() => setShowExternal(!showExternal)}>{showExternal ? "Hide assigned reviewers": "All assigned reviewers"}</a> + } + { showExternal && + renderReviewBlock(peopleNotReviewed) + } + </> + } return ( <SidebarBlock title="Reviews & assignees"> + { partner.length === 0 && staff.length === 0 && nonStaff.length === 0 && <h5>No reviews available</h5>} <ReviewBlock score={data.score} recommendation={data.recommendation.display}> - {renderReviewBlock(staffReviewed)} - {renderReviewBlock(staffNotReviewed)} - <hr /> - { renderReviewBlock(nonStaffReviewed) } - { nonStaffNotReviewed.length !== 0 && - <a onClick={() => setShowExternal(!showExternal)}>{showExternal ? "Hide assigned reviewers": "All assigned reviewers"}</a> - } - { showExternal && - renderReviewBlock(nonStaffNotReviewed) - } + { renderNormal(staff) } + { staff.length !== 0 && partner.length !== 0 && <hr /> } + { renderNormal(partner) } + { (partner.length !== 0 || staff.length !== 0) && nonStaff.length !== 0 && <hr /> } + { renderCollapsed(nonStaff) } + </ReviewBlock> </SidebarBlock> ) diff --git a/opentech/static_src/src/javascript/apply/batch-actions.js b/opentech/static_src/src/javascript/apply/batch-actions.js index c3d487058c40275552f7b7f3e37df3cec35265e4..325a4a21b9ccbabe6846e46223b2504886dd00ff 100644 --- a/opentech/static_src/src/javascript/apply/batch-actions.js +++ b/opentech/static_src/src/javascript/apply/batch-actions.js @@ -19,14 +19,13 @@ const closedClass = 'is-closed'; $batchDetermineSend.click(function (e) { - if(!$batchDetermineForm[0].checkValidity()) { + if (!$batchDetermineForm[0].checkValidity()) { $batchDetermineForm.submit(); e.preventDefault(); } }); $batchDetermineConfirm.click(function (e) { - debugger; $batchDetermineForm.find(':submit').click(); e.preventDefault(); }); diff --git a/opentech/static_src/src/javascript/apply/fancybox-global.js b/opentech/static_src/src/javascript/apply/fancybox-global.js index 41b329ccc0e5012d5aeb1f71c86c5ecfc4c420d2..25d6425910cebdcf33e1a5d4643a91c412d3827d 100644 --- a/opentech/static_src/src/javascript/apply/fancybox-global.js +++ b/opentech/static_src/src/javascript/apply/fancybox-global.js @@ -8,7 +8,8 @@ afterClose: function () { if ($('.django-select2-checkboxes').length) { $('.django-select2-checkboxes').select2('close'); - } } + } + } }); // Close any open select2 dropdowns when inside a modal