Skip to content
Snippets Groups Projects
Commit c947deb2 authored by Erin Mullaney's avatar Erin Mullaney Committed by Todd Dembrey
Browse files

810 test update

parent a3d31e3d
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,11 @@
</div>
<div class="wrapper wrapper--large wrapper--inner-space-medium">
<div class="wrapper wrapper--large wrapper--inner-space-medium">
{% if closed_rounds or open_rounds %}
{% include "funds/includes/round-block.html" with closed_rounds=closed_rounds open_rounds=open_rounds title=rounds_title %}
{% endif %}
<h3>Applications to review</h3>
{% if in_review.data %}
{% render_table in_review %}
......@@ -30,4 +35,5 @@
{% block extra_js %}
<script src="{% static 'js/apply/submission-tooltips.js' %}"></script>
<script src="{% static 'js/apply/tabs.js' %}"></script>
{% endblock %}
......@@ -3,7 +3,7 @@ from django.views.generic import TemplateView
from django_tables2 import RequestConfig
from django_tables2.views import SingleTableView
from opentech.apply.funds.models import ApplicationSubmission
from opentech.apply.funds.models import ApplicationSubmission, RoundsAndLabs
from opentech.apply.funds.tables import SubmissionsTable, AdminSubmissionsTable
from opentech.apply.utils.views import ViewDispatcher
......@@ -15,9 +15,21 @@ class AdminDashboardView(TemplateView):
in_review = SubmissionsTable(qs.in_review_for(request.user), prefix='in-review-')
RequestConfig(request, paginate={'per_page': 10}).configure(in_review)
base_query = RoundsAndLabs.objects.with_progress().active().order_by('-end_date')
base_query = base_query.by_lead(request.user)
open_rounds = base_query.open()[:6]
open_query = '?round_state=open'
closed_rounds = base_query.closed()[:6]
closed_query = '?round_state=closed'
rounds_title = 'Your rounds and labs'
return render(request, 'dashboard/dashboard.html', {
'in_review': in_review,
'open_rounds': open_rounds,
'open_query': open_query,
'closed_rounds': closed_rounds,
'closed_query': closed_query,
'rounds_title': rounds_title,
})
......
<div class="wrapper wrapper--bottom-space">
<section class="section section--with-options">
<h4 class="heading heading--normal heading--no-margin">Your Rounds and Labs</h4>
<h4 class="heading heading--normal heading--no-margin">{{ title }}</h4>
<div class="js-tabs">
<a class="tab__item tab__item--alt" href="#closed-rounds" data-tab="tab-1">Closed</a>
<a class="tab__item tab__item--alt" href="#open-rounds" data-tab="tab-2">Open</a>
......
......@@ -16,7 +16,7 @@
<div class="wrapper wrapper--large wrapper--inner-space-medium">
{% if closed_rounds or open_rounds %}
{% include "funds/includes/round-block.html" with closed_rounds=closed_rounds open_rounds=open_rounds %}
{% include "funds/includes/round-block.html" with closed_rounds=closed_rounds open_rounds=open_rounds title=rounds_title %}
{% endif %}
{% block table %}
......
......@@ -77,6 +77,7 @@ class BaseRoundsAndLabTestCase:
self.assertEqual(qs_all.count(), 2)
self.assertEqual(qs_by_lead.count(), 1)
self.assertEqual(fetched_obj.lead, obj.lead.full_name)
self.assertNotEqual(round_other_lead.title, fetched_obj.title)
class TestForLab(BaseRoundsAndLabTestCase, TestCase):
......
......@@ -89,24 +89,21 @@ class SubmissionOverviewView(AllActivityContextMixin, BaseAdminSubmissionsTable)
return super().get_table_data().order_by(F('last_update').desc(nulls_last=True))[:5]
def get_context_data(self, **kwargs):
# For OTF staff, display rounds/labs where user is the lead
if self.request.user.is_staff:
base_query = RoundsAndLabs.objects.with_progress().active().order_by('-end_date')
base_query = base_query.by_lead(self.request.user)
open_rounds = base_query.open()[:6]
open_query = '?round_state=open'
closed_rounds = base_query.closed()[:6]
closed_query = '?round_state=closed'
return super().get_context_data(
open_rounds=open_rounds,
open_query=open_query,
closed_rounds=closed_rounds,
closed_query=closed_query,
**kwargs,
)
else:
return super().get_context_data(**kwargs)
base_query = RoundsAndLabs.objects.with_progress().active().order_by('-end_date')
open_rounds = base_query.open()[:6]
open_query = '?round_state=open'
closed_rounds = base_query.closed()[:6]
closed_query = '?round_state=closed'
rounds_title = 'All Rounds and Labs'
return super().get_context_data(
open_rounds=open_rounds,
open_query=open_query,
closed_rounds=closed_rounds,
closed_query=closed_query,
rounds_title=rounds_title,
**kwargs,
)
class SubmissionListView(AllActivityContextMixin, BaseAdminSubmissionsTable):
......
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