Skip to content

Commit 5f16635

Browse files
committed
Added comment docevents when changing SessionPresentation objects. Reworked group materials page to be more helpful when there are multiple SessionPresentations withing a given Meeting
- Legacy-Id: 8705
1 parent b7d8ed8 commit 5f16635

3 files changed

Lines changed: 39 additions & 3 deletions

File tree

ietf/doc/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def future_presentations(self):
203203
""" returns related SessionPresentation objects for meetings that
204204
have not yet ended. This implementation allows for 2 week meetings """
205205
candidate_presentations = self.sessionpresentation_set.filter(session__meeting__date__gte=datetime.date.today()-datetime.timedelta(days=15))
206-
return [pres for pres in candidate_presentations if pres.session.meeting.end_date()>=datetime.date.today()]
206+
return sorted([pres for pres in candidate_presentations if pres.session.meeting.end_date()>=datetime.date.today()], key=lambda x:x.session.meeting.date)
207207

208208
def last_presented(self):
209209
""" returns related SessionPresentation objects for the most recent meeting in the past"""

ietf/doc/views_material.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,19 @@ def time_sort_key(session):
270270
if initial['version'] != new_selection:
271271
if initial['version'] == 'notpresented':
272272
doc.sessionpresentation_set.create(session=session,rev=new_selection)
273+
c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
274+
c.desc = "Added version %s to session: %s" % (new_selection,session)
275+
c.save()
273276
elif new_selection == 'notpresented':
274277
doc.sessionpresentation_set.filter(session=session).delete()
278+
c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
279+
c.desc = "Removed from session: %s" % (session)
280+
c.save()
275281
else:
276282
doc.sessionpresentation_set.filter(session=session).update(rev=new_selection)
283+
c = DocEvent(type="added_comment", doc=doc, by=request.user.person)
284+
c.desc = "Revision for session %s changed to %s" % (session,new_selection)
285+
c.save()
277286
return redirect('doc_view',name=doc.name)
278287
else:
279288
form = MaterialVersionForm(choices=choices,initial=initial)

ietf/templates/group/materials.html

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,35 @@ <h2>{{ doc_type.name }}</h2>
3333
<td class='snippable'>{{ d.abstract|format_snippet }} </td>
3434
<td>{{ d.rev }}</td>
3535
<td>{{ d.time|date:"Y-m-d" }}</td>
36-
<td>{% for p in d.last_presented %}{{p.session.meeting}}{% if d.rev != p.rev %} (-{{ p.rev }}){% endif %}{%if not forloop.last%}, {% endif %}{% endfor %}</td>
37-
<td>{% for p in d.future_presentations %}{{p.session.meeting}}{% if d.rev != p.rev %} (-{{p.rev}}){%endif%}{%if not forloop.last%}, {%endif%}{%endfor%}</td>
36+
<td>{% regroup d.last_presented by session.meeting as past_pres_list %}
37+
{% for p in past_pres_list %}
38+
{{ p.grouper }}
39+
{% if p.list|length > 1 %}
40+
( {{ p.list|length }} sessions )
41+
{% else %}
42+
{% for pr in p.list %}
43+
{% if pr.rev != d.rev %}
44+
(-{{ pr.rev }})
45+
{% endif %}
46+
{% endfor %}
47+
{% endif %}
48+
{% if not forloop.last %}, {% endif %}
49+
{% endfor %}
50+
<td>{% regroup d.future_presentations by session.meeting as meeting_pres_list %}
51+
{% for p in meeting_pres_list %}
52+
{{ p.grouper }}
53+
{% if p.list|length > 1 %}
54+
( {{ p.list|length }} sessions )
55+
{% else %}
56+
{% for pr in p.list %}
57+
{% if pr.rev != d.rev %}
58+
(-{{ pr.rev }})
59+
{% endif %}
60+
{% endfor %}
61+
{% endif %}
62+
{% if not forloop.last %}, {% endif %}
63+
{% endfor %}
64+
</td>
3865
</tr>
3966
{% endfor %}
4067
</table>

0 commit comments

Comments
 (0)