Skip to content

Commit 4b72ced

Browse files
authored
feat: more detailed view of all docs in iesg processing (#8838)
* feat: more detailed view of all docs in iesg processing * fix: commit new template * feat: cache the new page for 5m in slowpages * fix: add endcache
1 parent f64470c commit 4b72ced

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed

ietf/doc/tests.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,30 @@ def test_docs_for_ad(self):
403403
self.assertContains(r, discuss_other.doc.name)
404404
self.assertContains(r, block_other.doc.name)
405405

406+
def test_docs_for_iesg(self):
407+
ad1 = RoleFactory(name_id='ad',group__type_id='area',group__state_id='active').person
408+
ad2 = RoleFactory(name_id='ad',group__type_id='area',group__state_id='active').person
409+
410+
draft = IndividualDraftFactory(ad=ad1)
411+
draft.action_holders.set([PersonFactory()])
412+
draft.set_state(State.objects.get(type='draft-iesg', slug='lc'))
413+
rfc = IndividualRfcFactory(ad=ad2)
414+
conflrev = DocumentFactory(type_id='conflrev',ad=ad1)
415+
conflrev.set_state(State.objects.get(type='conflrev', slug='iesgeval'))
416+
statchg = DocumentFactory(type_id='statchg',ad=ad2)
417+
statchg.set_state(State.objects.get(type='statchg', slug='iesgeval'))
418+
charter = CharterFactory(name='charter-ietf-ames',ad=ad1)
419+
charter.set_state(State.objects.get(type='charter', slug='iesgrev'))
420+
421+
r = self.client.get(urlreverse('ietf.doc.views_search.docs_for_iesg'))
422+
self.assertEqual(r.status_code, 200)
423+
self.assertContains(r, draft.name)
424+
self.assertContains(r, escape(draft.action_holders.first().name))
425+
self.assertContains(r, rfc.name)
426+
self.assertContains(r, conflrev.name)
427+
self.assertContains(r, statchg.name)
428+
self.assertContains(r, charter.name)
429+
406430
def test_auth48_doc_for_ad(self):
407431
"""Docs in AUTH48 state should have a decoration"""
408432
ad = RoleFactory(name_id='ad', group__type_id='area', group__state_id='active').person

ietf/doc/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
url(r'^ad/?$', views_search.ad_workload),
5454
url(r'^ad/(?P<name>[^/]+)/?$', views_search.docs_for_ad),
5555
url(r'^ad2/(?P<name>[\w.-]+)/$', RedirectView.as_view(url='/doc/ad/%(name)s/', permanent=True)),
56+
url(r'^for_iesg/?$', views_search.docs_for_iesg),
5657
url(r'^rfc-status-changes/?$', views_status_change.rfc_status_changes),
5758
url(r'^start-rfc-status-change/(?:%(name)s/)?$' % settings.URL_REGEXPS, views_status_change.start_rfc_status_change),
5859
url(r'^bof-requests/?$', views_bofreq.bof_requests),

ietf/doc/views_search.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -752,6 +752,68 @@ def sort_key(doc):
752752
)
753753

754754

755+
def docs_for_iesg(request):
756+
def sort_key(doc):
757+
dt = doc_type(doc)
758+
dt_key = list(AD_WORKLOAD.keys()).index(dt)
759+
ds = doc_state(doc)
760+
ds_key = AD_WORKLOAD[dt].index(ds) if ds in AD_WORKLOAD[dt] else 99
761+
return dt_key * 100 + ds_key
762+
763+
results, meta = prepare_document_table(
764+
request,
765+
Document.objects.filter(
766+
ad__in=Person.objects.filter(
767+
Q(
768+
role__name__in=("pre-ad", "ad"),
769+
role__group__type="area",
770+
role__group__state="active",
771+
)
772+
)
773+
),
774+
max_results=1000,
775+
show_ad_and_shepherd=True,
776+
)
777+
results.sort(key=lambda d: sort_key(d))
778+
779+
# filter out some results
780+
results = [
781+
r
782+
for r in results
783+
if not (
784+
r.type_id == "charter"
785+
and (
786+
r.group.state_id == "abandon"
787+
or r.get_state_slug("charter") == "replaced"
788+
)
789+
)
790+
and not (
791+
r.type_id == "draft"
792+
and (
793+
r.get_state_slug("draft-iesg") == "dead"
794+
or r.get_state_slug("draft") == "repl"
795+
or r.get_state_slug("draft") == "rfc"
796+
)
797+
)
798+
]
799+
800+
_calculate_state_name = get_state_name_calculator()
801+
for d in results:
802+
dt = d.type.slug
803+
d.search_heading = _calculate_state_name(dt, doc_state(d))
804+
if d.search_heading != "RFC":
805+
d.search_heading += f" {doc_type_name(dt)}"
806+
807+
return render(
808+
request,
809+
"doc/drafts_for_iesg.html",
810+
{
811+
"docs": results,
812+
"meta": meta,
813+
},
814+
)
815+
816+
755817
def drafts_in_last_call(request):
756818
lc_state = State.objects.get(type="draft-iesg", slug="lc").pk
757819
form = SearchForm({'by':'state','state': lc_state, 'rfcs':'on', 'activedrafts':'on'})
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{% extends "base.html" %}
2+
{# Copyright The IETF Trust 2015, All Rights Reserved #}
3+
{% load origin static %}
4+
{% load ietf_filters %}
5+
{% load person_filters %}
6+
{% block pagehead %}
7+
<link rel="stylesheet" href="{% static "ietf/css/list.css" %}">
8+
{% endblock %}
9+
{% block title %}Documents for the IESG{% endblock %}
10+
{% block content %}
11+
{% cache 300 ietf_doc_drafts_for_iesg using="slowpages" %}
12+
{% origin %}
13+
<h1 class="mt-4">Documents for the IESG</h1>
14+
{% include "doc/search/search_results.html" with start_table=True end_table=True %}
15+
{% endcache %}
16+
{% endblock %}
17+
{% block js %}
18+
<script src="{% static "ietf/js/list.js" %}"></script>
19+
{% endblock %}

0 commit comments

Comments
 (0)