Skip to content

Commit 8499beb

Browse files
committed
Added a 'Recent documents' to the IESG pages.
- Legacy-Id: 14300
1 parent 77d5f1c commit 8499beb

8 files changed

Lines changed: 77 additions & 20 deletions

File tree

PLAN

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ Updated: $Date$
77
Planned work in rough order
88
===========================
99

10-
* Add a 'recent ballots' page (IESG request)
11-
1210
* Add email thread search links to IESG ballots.
1311

1412
* Add an API to post IESG ballot comments

ietf/doc/models.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,14 @@ def ballot_open(self, ballot_type_slug):
344344
e = self.latest_event(BallotDocEvent, ballot_type__slug=ballot_type_slug)
345345
return e and not e.type == "closed_ballot"
346346

347+
def latest_ballot(self):
348+
"""Returns the most recently created ballot"""
349+
ballot = self.latest_event(BallotDocEvent, type__in=("created_ballot", "closed_ballot"))
350+
return ballot
351+
347352
def active_ballot(self):
348353
"""Returns the most recently created ballot if it isn't closed."""
349-
ballot = self.latest_event(BallotDocEvent, type__in=("created_ballot", "closed_ballot"))
354+
ballot = self.latest_ballot()
350355
if ballot and ballot.type == "created_ballot":
351356
return ballot
352357
else:
@@ -649,9 +654,15 @@ def telechat_date(self, e=None):
649654
return e.telechat_date if e and e.telechat_date and e.telechat_date >= datetime.date.today() else None
650655

651656
def past_telechat_date(self):
657+
"Return the latest telechat date if it isn't in the future; else None"
652658
e = self.latest_event(TelechatDocEvent, type="scheduled_for_telechat")
653659
return e.telechat_date if e and e.telechat_date and e.telechat_date < datetime.date.today() else None
654660

661+
def previous_telechat_date(self):
662+
"Return the most recent telechat date in the past, if any (even if there's another in the future)"
663+
e = self.latest_event(TelechatDocEvent, type="scheduled_for_telechat", telechat_date__lt=datetime.datetime.now())
664+
return e.telechat_date if e else None
665+
655666
def area_acronym(self):
656667
g = self.group
657668
if g:

ietf/iesg/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353

5454
url(r'^agenda/documents.txt$', views.agenda_documents_txt),
5555
url(r'^agenda/documents/$', views.agenda_documents),
56+
url(r'^past/documents/$', views.past_documents),
5657
url(r'^agenda/telechat-(?:%(date)s-)?docs.tgz' % settings.URL_REGEXPS, views.telechat_docs_tarfile),
5758
url(r'^discusses/$', views.discusses),
5859
url(r'^milestones/$', views.milestones_needing_review),

ietf/iesg/views.py

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
from django.contrib.sites.models import Site
5252

5353

54-
from ietf.doc.models import Document, TelechatDocEvent, LastCallDocEvent, ConsensusDocEvent, DocEvent, IESG_BALLOT_ACTIVE_STATES
54+
from ietf.doc.models import Document, State, TelechatDocEvent, LastCallDocEvent, ConsensusDocEvent, DocEvent, IESG_BALLOT_ACTIVE_STATES
5555
from ietf.doc.utils import update_telechat, augment_events_with_revision
5656
from ietf.group.models import GroupMilestone, Role
5757
from ietf.iesg.agenda import agenda_data, agenda_sections, fill_in_agenda_docs, get_agenda_date
@@ -179,6 +179,14 @@ def agenda_json(request, date=None):
179179

180180
return HttpResponse(json.dumps(res, indent=2), content_type='text/plain')
181181

182+
# def past_agendas(request):
183+
# # This is not particularly useful with the current way of constructing
184+
# # an agenda, because the code and data strucutes assume we're showing
185+
# # the current agenda, and documents on later agendas won't show on
186+
# # earlier agendas, even if they were actually on them.
187+
# telechat_dates = TelechatDate.objects.filter(date__lt=datetime.date.today(), date__gte=datetime.date(2012,3,1))
188+
# return render(request, 'iesg/past_agendas.html', {'telechat_dates': telechat_dates })
189+
182190
def agenda(request, date=None):
183191
data = agenda_data(date)
184192

@@ -380,6 +388,41 @@ def agenda_documents(request):
380388
request.session['ballot_edit_return_point'] = request.path_info
381389
return render(request, 'iesg/agenda_documents.html', { 'telechats': telechats })
382390

391+
def past_documents(request):
392+
iesg_state_slugs = ('approved', 'iesg-eva')
393+
iesg_states = State.objects.filter(type='draft-iesg', slug__in=iesg_state_slugs)
394+
possible_docs = Document.objects.filter(models.Q(states__type="draft-iesg",
395+
states__slug__in=iesg_state_slugs) |
396+
models.Q(states__type__in=("statchg", "conflrev"),
397+
states__slug__in=("appr-pr", )),
398+
)
399+
possible_docs = possible_docs.select_related("stream", "group", "ad").distinct()
400+
401+
docs = []
402+
for doc in possible_docs:
403+
ballot = doc.latest_ballot()
404+
blocking_positions = []
405+
if ballot:
406+
blocking_positions = [p for p in ballot.all_positions() if p.pos.blocking]
407+
if blocking_positions:
408+
augment_events_with_revision(doc, blocking_positions)
409+
410+
doc.by_me = bool([p for p in blocking_positions if user_is_person(request.user, p.ad)])
411+
doc.for_me = user_is_person(request.user, doc.ad)
412+
doc.milestones = doc.groupmilestone_set.filter(state="active").order_by("time").select_related("group")
413+
doc.blocking_positions = blocking_positions
414+
doc.telechat = doc.previous_telechat_date()
415+
416+
if doc.telechat:
417+
docs.append(doc)
418+
419+
# latest first
420+
#docs.sort(key=lambda d: d.latest_event().time, reverse=True)
421+
docs.sort(key=lambda d: d.telechat, reverse=True)
422+
423+
return render(request, 'iesg/past_documents.html', { 'docs': docs, 'states': iesg_states })
424+
425+
383426
def telechat_docs_tarfile(request, date):
384427
date = get_agenda_date(date)
385428

ietf/templates/iesg/agenda.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@
2525
<h1>IESG agenda: {{ date }} </h1>
2626

2727
<ul class="nav nav-tabs" role="tablist">
28-
<li class="active"><a href="/iesg/agenda/">IESG Agenda</a></li>
29-
<li class=" "><a href="/iesg/agenda/documents/">Documents on future agendas</a></li>
30-
<li class=" "><a href="/iesg/discusses/">DISCUSS positions</a></li>
31-
<li class=" "><a href="{% url "ietf.iesg.views.photos" %}">IESG Photos</a></li>
28+
<li class="active"><a href="{% url 'ietf.iesg.views.agenda' %}">IESG Agenda</a></li>
29+
<li class=" "><a href="{% url 'ietf.iesg.views.agenda_documents' %}">Documents on future agendas</a></li>
30+
<li class=" "><a href="{% url 'ietf.iesg.views.discusses' %}">DISCUSS positions</a></li>
31+
<li class=" "><a href="{% url 'ietf.iesg.views.past_documents' %}">Documents on recent agendas</a></li>
32+
<li class=" "><a href="{% url 'ietf.iesg.views.photos' %}">IESG Photos</a></li>
3233
</ul>
3334

3435
{% for num, section in sections %}

ietf/templates/iesg/agenda_documents.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,11 @@
2323
<h1>Documents on future IESG telechat agendas</h1>
2424

2525
<ul class="nav nav-tabs" role="tablist">
26-
<li class=" "><a href="/iesg/agenda/">IESG Agenda</a></li>
27-
<li class="active"><a href="/iesg/agenda/documents/">Documents on future agendas</a></li>
28-
<li class=" "><a href="/iesg/discusses/">DISCUSS positions</a></li>
29-
<li class=" "><a href="{% url "ietf.iesg.views.photos" %}">IESG Photos</a></li>
26+
<li class=" "><a href="{% url 'ietf.iesg.views.agenda' %}">IESG Agenda</a></li>
27+
<li class="active"><a href="{% url 'ietf.iesg.views.agenda_documents' %}">Documents on future agendas</a></li>
28+
<li class=" "><a href="{% url 'ietf.iesg.views.discusses' %}">DISCUSS positions</a></li>
29+
<li class=" "><a href="{% url 'ietf.iesg.views.past_documents' %}">Documents on recent agendas</a></li>
30+
<li class=" "><a href="{% url 'ietf.iesg.views.photos' %}">IESG Photos</a></li>
3031
</ul>
3132

3233

ietf/templates/iesg/discusses.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
<h1>IESG discuss positions</h1>
1717

1818
<ul class="nav nav-tabs" role="tablist">
19-
<li class=" "><a href="/iesg/agenda/">IESG Agenda</a></li>
20-
<li class=" "><a href="/iesg/agenda/documents/">Documents on future agendas</a></li>
21-
<li class="active"><a href="/iesg/discusses/">DISCUSS positions</a></li>
22-
<li class=" "><a href="{% url "ietf.iesg.views.photos" %}">IESG Photos</a></li>
19+
<li class=" "><a href="{% url 'ietf.iesg.views.agenda' %}">IESG Agenda</a></li>
20+
<li class=" "><a href="{% url 'ietf.iesg.views.agenda_documents' %}">Documents on future agendas</a></li>
21+
<li class="active"><a href="{% url 'ietf.iesg.views.discusses' %}">DISCUSS positions</a></li>
22+
<li class=" "><a href="{% url 'ietf.iesg.views.past_documents' %}">Documents on recent agendas</a></li>
23+
<li class=" "><a href="{% url 'ietf.iesg.views.photos' %}">IESG Photos</a></li>
2324
</ul>
2425

2526

ietf/templates/iesg/photos.html

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@
1919
<h1>{{ group_type | upper }} {{ role }} Photos</h1>
2020

2121
<ul class="nav nav-tabs" role="tablist">
22-
<li ><a href="/iesg/agenda/documents/">IESG Agenda</a></li>
23-
<li ><a href="/iesg/agenda/documents/">Documents on future agendas</a></li>
24-
<li ><a href="/iesg/discusses/">DISCUSS positions</a></li>
25-
<li class="active"><a href="{% url "ietf.iesg.views.photos" %}">IESG Photos</a></li>
22+
<li class=" "><a href="{% url 'ietf.iesg.views.agenda' %}">IESG Agenda</a></li>
23+
<li class=" "><a href="{% url 'ietf.iesg.views.agenda_documents' %}">Documents on future agendas</a></li>
24+
<li class=" "><a href="{% url 'ietf.iesg.views.discusses' %}">DISCUSS positions</a></li>
25+
<li class=" "><a href="{% url 'ietf.iesg.views.past_documents' %}">Documents on recent agendas</a></li>
26+
<li class="active"><a href="{% url 'ietf.iesg.views.photos' %}">IESG Photos</a></li>
2627
</ul>
2728

2829
{% regroup roles by group.acronym as alphabet_blocks %}

0 commit comments

Comments
 (0)