Fixes for questions for you. Does not include any changes in docker/

- Legacy-Id: 17150
This commit is contained in:
Peter E. Yee 2019-12-13 23:01:06 +00:00
parent bb7e504d14
commit 8313b0adbf
4 changed files with 7 additions and 60 deletions

View file

@ -180,15 +180,10 @@ class IssueIRSGBallotTests(TestCase):
# Press the No button - expect nothing but a redirect back to the draft's main page
r = self.client.post(url,dict(irsg_button="No"))
self.assertEqual(r.status_code, 302)
# PEY: Insert assertion about the redirect URL
# Press the Yes button
r = self.client.post(url,dict(irsg_button="Yes", duedate="2038-01-19"))
self.assertEqual(r.status_code, 302)
# PEY: Check on whether the ballot is reflected in the BallotDocEvents table
# Can't get ballot_type to work in the filter below, so commented out for now
# ballot_type = BallotType.objects.get(doc_type=rg_draft.type,slug='irsg-approve')
# debug.show("ballot_type")
ballot_created = list(BallotDocEvent.objects.filter(doc=rg_draft1,
type="created_ballot"))
self.assertNotEqual(len(ballot_created), 0)
@ -392,12 +387,9 @@ class BaseManipulationTests():
def test_view_outstanding_ballots(self):
draft = RgDraftFactory()
# PEY: Commented out RJS' following line., Will need this in the future when irsg_ballot_status changes to take a ballot not a doc
# ballot = IRSGBallotDocEventFactory(doc=draft)
IRSGBallotDocEventFactory(doc=draft)
url = urlreverse('ietf.doc.views_ballot.irsg_ballot_status')
login_testing_unauthorized(self, self.username, url)
r = self.client.get(url)
self.assertEqual(r.status_code, 200)
self.assertIn(draft.name, unicontent(r))
@ -439,8 +431,6 @@ class IRSGMemberTests(TestCase):
def test_cant_close_irsg_ballot(self):
draft = RgDraftFactory()
# PEY: Commented out RJS' following line. Will need this in the future when close_irsg_ballot changes to taking a ballot not a doc
# ballot = IRSGBallotDocEventFactory(doc=draft)
IRSGBallotDocEventFactory(doc=draft)
url = urlreverse('ietf.doc.views_ballot.close_irsg_ballot', kwargs=dict(name=draft.name))

View file

@ -213,7 +213,6 @@ def edit_position(request, name, ballot_id):
if request.method == 'POST':
old_pos = None
# PEY: if not has_role(request.user, "Secretariat") and not pos_by.role_set.filter(name="ad", group__type="area", group__state="active"):
if not has_role(request.user, "Secretariat") and not can_ballot(request.user, doc):
# prevent pre-ADs from voting
return HttpResponseForbidden("Must be a proper Area Director in an active area or IRSG Member to cast ballot")
@ -327,7 +326,6 @@ def build_position_email(pos_by, doc, pos):
pos=pos.pos,
blocking_name=blocking_name,
settings=settings))
# PEY: This doesn't work properly for IRSG members, since they don't have the "ad" role. It still manages to get an address so it doesn't have to be fixed as a first priority.
frm = pos_by.role_email("ad").formatted_email()
if doc.stream_id == "irtf":
@ -1090,13 +1088,11 @@ def issue_irsg_ballot(request, name):
if (duedate == None or duedate==""):
duedate = str(fillerdate)
e.duedate = datetime.datetime.strptime(duedate, '%Y-%m-%d')
# PEY: What's the best thing to do for "unreasonable" dates?
e.type = "created_ballot"
e.desc = "Created IRSG Ballot"
ballot_type = BallotType.objects.get(doc_type=doc.type, slug="irsg-approve")
e.ballot_type = ballot_type
e.save()
# PEY: This is probably not enough state setting/cleanup. I should review the IESG version more to see what happens.
new_state = doc.get_state()
prev_tags = []
new_tags = []
@ -1121,7 +1117,7 @@ def issue_irsg_ballot(request, name):
else:
templ = 'doc/ballot/irsg_ballot_approve.html'
question = "Are you sure you really want to issue a ballot for " + name + "?"
question = "Confirm issuing a ballot for " + name + "?"
return render(request, templ, dict(doc=doc,
question=question, fillerdate=fillerdate))
@ -1136,43 +1132,16 @@ def close_irsg_ballot(request, name):
if request.method == 'POST':
button = request.POST.__getitem__("irsg_button")
if button == 'Yes':
e = BallotDocEvent(doc=doc, rev=doc.rev, by=request.user.person)
e.type = "closed_ballot"
e.desc = "Closed IRSG Ballot"
ballot_type = BallotType.objects.get(doc_type=doc.type, slug="irsg-approve")
e.ballot_type = ballot_type
e.save()
# PEY: This is probably not enough state setting/cleanup. I should review the IESG version more to see what happens.
new_state = doc.get_state()
prev_tags = []
new_tags = []
# PEY: Need to determine what the correct state to transition to is.
if doc.type_id == 'draft':
new_state = State.objects.get(used=True, type="draft-stream-irtf", slug='active')
prev_state = doc.get_state(new_state.type_id if new_state else None)
doc.set_state(new_state)
doc.tags.remove(*prev_tags)
events = []
state_change_event = add_state_change_event(doc, by, prev_state, new_state, prev_tags=prev_tags, new_tags=new_tags)
if state_change_event:
events.append(state_change_event)
if events:
doc.save_with_history(events)
close_ballot(doc, by, "irsg-approve")
return HttpResponseRedirect(doc.get_absolute_url())
templ = 'doc/ballot/irsg_ballot_close.html'
question = "Are you sure you really want to close the ballot for " + name + "?"
question = "Confirm closing the ballot for " + name + "?"
return render(request, templ, dict(doc=doc,
question=question))
@role_required('Secretariat', 'IRTF Chair')
def irsg_ballot_status(request):
possible_docs = Document.objects.filter(docevent__ballotdocevent__irsgballotdocevent__isnull=False)
docs = []
@ -1181,7 +1150,6 @@ def irsg_ballot_status(request):
ballot = doc.active_ballot()
if ballot:
doc.ballot = ballot
# PEY: Need to figure how to work the duedate into status_columns.html
# PEY: Also, how is it I can add duedate to doc just like that?
doc.duedate=datetime.datetime.strftime(ballot.irsgballotdocevent.duedate, '%Y-%m-%d')

View file

@ -83,12 +83,9 @@ from ietf.utils.text import maybe_split
def render_document_top(request, doc, tab, name):
# PEY: Figuring out what tab value is
tabs = []
tabs.append(("Status", "status", urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=name)), True, None))
# ballot = doc.latest_event(BallotDocEvent, type="created_ballot")
# ballot_type = BallotType.objects.get(doc_type=doc.type, slug="irsg-approve")
iesg_ballot = doc.latest_event(BallotDocEvent, type="created_ballot", ballot_type__slug='approve')
irsg_ballot = doc.latest_event(BallotDocEvent, type="created_ballot",ballot_type__slug='irsg-approve')
@ -504,7 +501,6 @@ def document_main(request, name, rev=None):
ballot_summary = None
if doc.get_state_slug() in ("intrev", "iesgrev"):
# PEY: Need to adjust this so that I check draft-stream-irtf state as well and generate an irsg_ballot_summary as needed...
active_ballot = doc.active_ballot()
if active_ballot:
ballot_summary = needed_ballot_positions(doc, list(active_ballot.active_balloteer_positions().values()))
@ -548,7 +544,6 @@ def document_main(request, name, rev=None):
content = markup_txt.markup(content)
ballot_summary = None
# PEY: Need to work in irsg_ballot_summary here as well
if doc.get_state_slug() in ("iesgeval") and doc.active_ballot():
ballot_summary = needed_ballot_positions(doc, list(doc.active_ballot().active_balloteer_positions().values()))
@ -576,7 +571,6 @@ def document_main(request, name, rev=None):
content = doc.text_or_error() # pyflakes:ignore
ballot_summary = None
# PEY: work in irsg_ballot_summary here too
if doc.get_state_slug() in ("iesgeval"):
ballot_summary = needed_ballot_positions(doc, list(doc.active_ballot().active_balloteer_positions().values()))
@ -1032,7 +1026,6 @@ def document_ballot_content(request, doc, ballot_id, editable=True):
else:
position_groups.append(g)
# PEY: Need to integrate irsg_needed_ballot_positions here as well.
if (ballot.ballot_type.slug == "irsg-approve"):
summary = irsg_needed_ballot_positions(doc, [p for p in positions if not p.old_pos_by])
else:
@ -1068,8 +1061,7 @@ def document_ballot(request, name, ballot_id=None):
if all_ballots:
ballot = all_ballots[-1]
else:
# PEY: What should I do if I somehow got here without any ballots existing? Can that happen? Passing for now.
pass
raise Http404("Ballot not found for: %s" % name)
ballot_id = ballot.id
else:
ballot_id = int(ballot_id)
@ -1079,8 +1071,7 @@ def document_ballot(request, name, ballot_id=None):
break
if not ballot_id or not ballot:
# PEY: Something bad happened. How do I gracefully bail out?
pass
raise Http404("Ballot not found for: %s" % name)
if ballot.ballot_type.slug == "approve":
ballot_tab = "ballot"

View file

@ -55,10 +55,8 @@
<li><a href="{% url 'ietf.doc.views_status_change.rfc_status_changes' %}">RFC status changes</a></li>
{% endif %}
{% if user|has_role:"IRTF Chair,Secretariat" %}
{% if flavor == "top" %}<li class="divider hidden-xs"></li>{% endif %}
<li><a href="{% url 'ietf.doc.views_ballot.irsg_ballot_status' %}">IRSG ballot status</a></li>
{% endif %}
{% if flavor == "top" %}<li class="divider hidden-xs"></li>{% endif %}
<li><a href="{% url 'ietf.doc.views_ballot.irsg_ballot_status' %}">IRSG ballot status</a></li>
{% if user|has_role:"WG Chair,RG Chair" %}
{% if flavor == "top" %}<li class="divider hidden-xs"></li>{% endif %}