Skip to content

Commit 95ef2ad

Browse files
committed
Fix problem in document import with ballot position document comments
now not having a "by NN" ending - Legacy-Id: 3435
1 parent 2682e49 commit 95ef2ad

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

redesign/importing/import-document-state.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ def date_in_match(match):
214214

215215
re_telechat_agenda = re.compile(r"(Placed on|Removed from) agenda for telechat(| - %s) by" % date_re_str)
216216
re_telechat_changed = re.compile(r"Telechat date (was|has been) changed to (<b>)?%s(</b>)? from" % date_re_str)
217-
re_ballot_position = re.compile(r"\[Ballot Position Update\] (New position, (?P<position>.*), has been recorded (|for (?P<for>.*) )|Position (|for (?P<for2>.*) )has been changed to (?P<position2>.*) from .*)by (?P<by>.*)")
218-
re_ballot_issued = re.compile(r"Ballot has been issued(| by)")
217+
re_ballot_position = re.compile(r"\[Ballot Position Update\] (New position, (?P<position>.*), has been recorded(| for (?P<for>.*) )|Position (|for (?P<for2>.*) )has been changed to (?P<position2>.*) from .*)(|by (?P<by>.*))")
218+
re_ballot_issued = re.compile(r"Ballot has been issued")
219219
re_state_changed = re.compile(r"(State (has been changed|changed|Changes) to <b>(?P<to>.*)</b> from (<b>|)(?P<from>.*)(</b> by|)|Sub state has been changed to (?P<tosub>.*) from (?P<fromsub>.*))")
220220
re_note_changed = re.compile(r"(\[Note\]: .*'.*'|Note field has been cleared)", re.DOTALL)
221221
re_draft_added = re.compile(r"Draft [Aa]dded (by .*)?( in state (?P<state>.*))?")
@@ -288,7 +288,10 @@ def import_from_idinternal(d, idinternal):
288288
match = re_ballot_position.search(c.comment_text)
289289
if match:
290290
position = ballot_position_mapping[match.group('position') or match.group('position2')]
291-
ad_name = match.group('for') or match.group('for2') or match.group('by') # some of the old positions don't specify who it's for, in that case assume it's "by", the person who entered the position
291+
# some of the old positions don't specify who it's for, in
292+
# that case assume it's "by", the person who entered the
293+
# position
294+
ad_name = match.group('for') or match.group('for2') or match.group('by') or (u"%s %s" % (c.created_by.first_name, c.created_by.last_name) if c.created_by else "")
292295
ad_first, ad_last = ad_name.split(' ')
293296
login = IESGLogin.objects.filter(first_name=ad_first, last_name=ad_last).order_by('user_level')[0]
294297
if iesg_login_is_secretary(login):

0 commit comments

Comments
 (0)