1414
1515from redesign .group .models import *
1616from redesign .name .models import *
17- from ietf .idtracker .models import AreaGroup , IETFWG , Area , AreaGroup , Acronym , AreaWGURL , IRTF
17+ from ietf .idtracker .models import AreaGroup , IETFWG , Area , AreaGroup , Acronym , AreaWGURL , IRTF , ChairsHistory , Role
1818
1919# imports IETFWG, Area, AreaGroup, Acronym
2020
21+ # also creates nomcom groups
22+
2123# FIXME: should also import IRTF
2224
2325# make sure we got the names
@@ -54,7 +56,38 @@ def name(name_class, slug, name, desc=""):
5456iesg_group .type = type_names ["ietf" ]
5557iesg_group .save ()
5658
59+ system_email , _ = Email .objects .get_or_create (address = "(System)" )
60+
61+
62+ # NomCom
63+ Group .objects .filter (acronym = "nomcom" ).delete ()
64+
65+ for o in ChairsHistory .objects .filter (chair_type = Role .NOMCOM_CHAIR ).order_by ("start_year" ):
66+ group = Group ()
67+ group .acronym = "nomcom"
68+ group .name = "IAB/IESG Nominating Committee %s/%s" % (o .start_year , o .end_year )
69+ if o .chair_type .person == o .person :
70+ s = state_names ["active" ]
71+ else :
72+ s = state_names ["conclude" ]
73+ group .state = s
74+ group .type = type_names ["ietf" ]
75+ group .parent = None
76+ group .save ()
5777
78+ # we need start/end year so fudge events
79+ e = GroupEvent (group = group , type = "started" )
80+ e .time = datetime .datetime (o .start_year , 5 , 1 , 12 , 0 , 0 )
81+ e .by = system_email
82+ e .desc = e .get_type_display ()
83+ e .save ()
84+
85+ e = GroupEvent (group = group , type = "concluded" )
86+ e .time = datetime .datetime (o .end_year , 5 , 1 , 12 , 0 , 0 )
87+ e .by = system_email
88+ e .desc = e .get_type_display ()
89+ e .save ()
90+
5891# Area
5992for o in Area .objects .all ():
6093 group , _ = Group .objects .get_or_create (acronym = o .area_acronym .acronym )
@@ -70,9 +103,20 @@ def name(name_class, slug, name, desc=""):
70103 group .parent = iesg_group
71104 group .comments = o .comments .strip () if o .comments else ""
72105
73- # FIXME: missing fields from old: concluded_date, last_modified_date, extra_email_addresses
74-
75106 group .save ()
107+
108+ # import events
109+ group .groupevent_set .all ().delete ()
110+
111+ if o .concluded_date :
112+ e = GroupEvent (group = group , type = "concluded" )
113+ e .time = datetime .datetime .combine (o .concluded_date , datetime .time (12 , 0 , 0 ))
114+ e .by = system_email
115+ e .desc = e .get_type_display ()
116+ e .save ()
117+
118+ # FIXME: missing fields from old: last_modified_date, extra_email_addresses
119+
76120
77121# IETFWG, AreaGroup
78122for o in IETFWG .objects .all ():
@@ -129,8 +173,24 @@ def name(name_class, slug, name, desc=""):
129173
130174 group .list_email = o .email_address if o .email_address else ""
131175 group .comments = o .comments .strip () if o .comments else ""
132- # FIXME: missing fields from old: proposed_date, start_date, dormant_date, concluded_date, meeting_scheduled, email_subscribe, email_keyword, email_archive, last_modified_date, meeting_scheduled_old
133176
134177 group .save ()
135178
136- # FIXME: IRTF
179+ # import events
180+ group .groupevent_set .all ().delete ()
181+
182+ def import_date_event (name ):
183+ d = getattr (o , "%s_date" % name )
184+ if d :
185+ e = GroupEvent (group = group , type = name )
186+ e .time = datetime .datetime .combine (d , datetime .time (12 , 0 , 0 ))
187+ e .by = system_email
188+ e .desc = e .get_type_display ()
189+ e .save ()
190+
191+ import_date_event ("proposed" )
192+ import_date_event ("start" )
193+ import_date_event ("concluded" )
194+ # dormant_date is empty on all so don't bother with that
195+
196+ # FIXME: missing fields from old: meeting_scheduled, email_subscribe, email_keyword, email_archive, last_modified_date, meeting_scheduled_old
0 commit comments