Skip to content

Commit 298adf3

Browse files
committed
Added 4 new fields to the meeting class, to hold draft submission cutoff information for the meeting. On request, changed the presentation of the cutoff times to show the last submission time, rather than the beginning of the cutoff time. Changed the cutoff hour format to support full timedelta information, not just a given hour (this was necessary in order to be able to set the requested 23:59:59 submission stop time).
- Legacy-Id: 9107
1 parent 01ade79 commit 298adf3

6 files changed

Lines changed: 156 additions & 40 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# -*- coding: utf-8 -*-
2+
from __future__ import unicode_literals
3+
4+
from django.db import models, migrations
5+
import timedelta.fields
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('meeting', '0001_initial'),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name='meeting',
17+
name='idsubmit_cutoff_day_offset_00',
18+
field=models.IntegerField(default=20, help_text=b'The number of days before the meeting start date when the submission of -00 drafts will be closed.'),
19+
preserve_default=True,
20+
),
21+
migrations.AddField(
22+
model_name='meeting',
23+
name='idsubmit_cutoff_day_offset_01',
24+
field=models.IntegerField(default=13, help_text=b'The number of days before the meeting start date when the submission of -01 drafts etc. will be closed.'),
25+
preserve_default=True,
26+
),
27+
migrations.AddField(
28+
model_name='meeting',
29+
name='idsubmit_cutoff_time_utc',
30+
field=timedelta.fields.TimedeltaField(default=86399.0, help_text=b'The time of day (UTC) after which submission will be closed. Use for example 23 hours, 59 minutes, 59 seconds.'),
31+
preserve_default=True,
32+
),
33+
migrations.AddField(
34+
model_name='meeting',
35+
name='idsubmit_cutoff_warning_days',
36+
field=timedelta.fields.TimedeltaField(default=1814400.0, help_text=b'How long before the 00 cutoff to start showing cutoff warnings. Use for example 21 days or 3 weeks.'),
37+
preserve_default=True,
38+
),
39+
]

ietf/meeting/models.py

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# mostly used by json_dict()
1616
#from django.template.defaultfilters import slugify, date as date_format, time as time_format
1717
from django.template.defaultfilters import date as date_format
18+
import timedelta
1819

1920
from timedeltafield import TimedeltaField
2021

@@ -55,6 +56,19 @@ class Meeting(models.Model):
5556
# more than one timezone, and the pytz module doesn't provide timezone
5657
# lookup information for all relevant city/country combinations.
5758
time_zone = models.CharField(blank=True, max_length=255, choices=timezones)
59+
idsubmit_cutoff_day_offset_00 = models.IntegerField(blank=True,
60+
default=settings.IDSUBMIT_DEFAULT_CUTOFF_DAY_OFFSET_00,
61+
help_text = "The number of days before the meeting start date when the submission of -00 drafts will be closed.")
62+
idsubmit_cutoff_day_offset_01 = models.IntegerField(blank=True,
63+
default=settings.IDSUBMIT_DEFAULT_CUTOFF_DAY_OFFSET_01,
64+
help_text = "The number of days before the meeting start date when the submission of -01 drafts etc. will be closed.")
65+
idsubmit_cutoff_time_utc = timedelta.fields.TimedeltaField(blank=True,
66+
default=settings.IDSUBMIT_DEFAULT_CUTOFF_TIME_UTC,
67+
help_text = "The time of day (UTC) after which submission will be closed. Use for example 23 hours, 59 minutes, 59 seconds.")
68+
idsubmit_cutoff_warning_days = timedelta.fields.TimedeltaField(blank=True,
69+
default=settings.IDSUBMIT_DEFAULT_CUTOFF_WARNING_DAYS,
70+
help_text = "How long before the 00 cutoff to start showing cutoff warnings. Use for example 21 days or 3 weeks.")
71+
#
5872
venue_name = models.CharField(blank=True, max_length=255)
5973
venue_addr = models.TextField(blank=True)
6074
break_area = models.CharField(blank=True, max_length=255)
@@ -83,17 +97,38 @@ def get_meeting_date (self,offset):
8397
def end_date(self):
8498
return self.get_meeting_date(5)
8599

100+
def get_00_cutoff(self):
101+
start_date = datetime.datetime(year=self.date.year, month=self.date.month, day=self.date.day, tzinfo=pytz.utc)
102+
cutoff_date = start_date - datetime.timedelta(days=self.idsubmit_cutoff_day_offset_00)
103+
cutoff_time = cutoff_date + self.idsubmit_cutoff_time_utc
104+
return cutoff_time
105+
106+
def get_01_cutoff(self):
107+
start_date = datetime.datetime(year=self.date.year, month=self.date.month, day=self.date.day, tzinfo=pytz.utc)
108+
cutoff_date = start_date - datetime.timedelta(days=self.idsubmit_cutoff_day_offset_01)
109+
cutoff_time = cutoff_date + self.idsubmit_cutoff_time_utc
110+
return cutoff_time
111+
112+
def get_reopen_time(self):
113+
start_date = datetime.datetime(year=self.date.year, month=self.date.month, day=self.date.day)
114+
local_tz = pytz.timezone(self.time_zone)
115+
local_date = local_tz.localize(start_date)
116+
reopen_time = local_date + self.idsubmit_cutoff_time_utc
117+
return reopen_time
118+
119+
@classmethod
120+
def get_current_meeting(cls, type="ietf"):
121+
return cls.objects.all().filter(type=type).order_by('-date').first()
122+
86123
@classmethod
87124
def get_first_cut_off(cls):
88-
date = cls.objects.all().filter(type="ietf").order_by('-date')[0].date
89-
offset = datetime.timedelta(days=settings.FIRST_CUTOFF_DAYS)
90-
return date - offset
125+
meeting = cls.get_current_meeting()
126+
return meeting.get_00_cutoff()
91127

92128
@classmethod
93129
def get_second_cut_off(cls):
94-
date = cls.objects.all().filter(type="ietf").order_by('-date')[0].date
95-
offset = datetime.timedelta(days=settings.SECOND_CUTOFF_DAYS)
96-
return date - offset
130+
meeting = cls.get_current_meeting()
131+
return meeting.get_01_cutoff()
97132

98133
@classmethod
99134
def get_ietf_monday(cls):
@@ -115,11 +150,11 @@ def get_materials_path(self):
115150

116151
# the various dates are currently computed
117152
def get_submission_start_date(self):
118-
return self.date + datetime.timedelta(days=settings.SUBMISSION_START_DAYS)
153+
return self.date + datetime.timedelta(days=settings.MEETING_MATERIALS_SUBMISSION_START_DAYS)
119154
def get_submission_cut_off_date(self):
120-
return self.date + datetime.timedelta(days=settings.SUBMISSION_CUTOFF_DAYS)
155+
return self.date + datetime.timedelta(days=settings.MEETING_MATERIALS_SUBMISSION_CUTOFF_DAYS)
121156
def get_submission_correction_date(self):
122-
return self.date + datetime.timedelta(days=settings.SUBMISSION_CORRECTION_DAYS)
157+
return self.date + datetime.timedelta(days=settings.MEETING_MATERIALS_SUBMISSION_CORRECTION_DAYS)
123158

124159
def get_schedule_by_name(self, name):
125160
return self.schedule_set.filter(name=name).first()

ietf/secr/drafts/fixtures/test-meeting.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"date": "2010-11-07",
1414
"type": "ietf",
1515
"venue_addr": ""
16+
"idsubmit_cutoff_day_offset_00": 20,
17+
"idsubmit_cutoff_day_offset_01": 13,
18+
"idsubmit_cutoff_time_utc": "23:59:59",
19+
"idsubmit_cutoff_warning_days": "21 days, 0:00:00",
1620
}
1721
},
1822
{
@@ -29,6 +33,10 @@
2933
"date": "2011-03-27",
3034
"type": "ietf",
3135
"venue_addr": ""
36+
"idsubmit_cutoff_day_offset_00": 20,
37+
"idsubmit_cutoff_day_offset_01": 13,
38+
"idsubmit_cutoff_time_utc": "23:59:59",
39+
"idsubmit_cutoff_warning_days": "21 days, 0:00:00",
3240
}
3341
},
3442
{
@@ -45,6 +53,10 @@
4553
"date": "2011-07-24",
4654
"type": "ietf",
4755
"venue_addr": ""
56+
"idsubmit_cutoff_day_offset_00": 20,
57+
"idsubmit_cutoff_day_offset_01": 13,
58+
"idsubmit_cutoff_time_utc": "23:59:59",
59+
"idsubmit_cutoff_warning_days": "21 days, 0:00:00",
4860
}
4961
},
5062
{
@@ -61,6 +73,10 @@
6173
"date": "2011-11-13",
6274
"type": "ietf",
6375
"venue_addr": ""
76+
"idsubmit_cutoff_day_offset_00": 20,
77+
"idsubmit_cutoff_day_offset_01": 13,
78+
"idsubmit_cutoff_time_utc": "23:59:59",
79+
"idsubmit_cutoff_warning_days": "21 days, 0:00:00",
6480
}
6581
},
6682
{
@@ -77,6 +93,10 @@
7793
"date": "2012-03-25",
7894
"type": "ietf",
7995
"venue_addr": ""
96+
"idsubmit_cutoff_day_offset_00": 20,
97+
"idsubmit_cutoff_day_offset_01": 13,
98+
"idsubmit_cutoff_time_utc": "23:59:59",
99+
"idsubmit_cutoff_warning_days": "21 days, 0:00:00",
80100
}
81101
}
82102
]

ietf/secr/meetings/tests.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ def test_add_meeting(self):
4949
url = reverse('meetings_add')
5050
post_data = dict(number=number,city='Toronto',date='2014-07-20',country='CA',
5151
time_zone='America/New_York',venue_name='Hilton',
52-
venue_addr='100 First Ave')
52+
venue_addr='100 First Ave',
53+
idsubmit_cutoff_day_offset_00=13,
54+
idsubmit_cutoff_day_offset_01=20,
55+
idsubmit_cutoff_time_utc =datetime.timedelta(hours=23, minutes=59, seconds=59),
56+
idsubmit_cutoff_warning_days =datetime.timedelta(days=21),
57+
)
5358
self.client.login(username='secretary', password='secretary+password')
5459
response = self.client.post(url, post_data, follow=True)
5560
self.assertEqual(response.status_code, 200)
@@ -59,9 +64,15 @@ def test_edit_meeting(self):
5964
"Edit Meeting"
6065
Meeting.objects.create(number=1,
6166
type_id='ietf',
62-
date=datetime.datetime(2014,7,20))
67+
date=datetime.datetime(2014,7,20),
68+
)
6369
url = reverse('meetings_edit_meeting',kwargs={'meeting_id':1})
64-
post_data = dict(number='1',date='2014-07-20',city='Toronto')
70+
post_data = dict(number='1',date='2014-07-20',city='Toronto',
71+
idsubmit_cutoff_day_offset_00=13,
72+
idsubmit_cutoff_day_offset_01=20,
73+
idsubmit_cutoff_time_utc =datetime.timedelta(hours=23, minutes=59, seconds=59),
74+
idsubmit_cutoff_warning_days =datetime.timedelta(days=21),
75+
)
6576
self.client.login(username="secretary", password="secretary+password")
6677
response = self.client.post(url, post_data,follow=True)
6778
self.assertEqual(response.status_code, 200)

ietf/settings.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import sys
2020
sys.path.append(os.path.abspath(BASE_DIR + "/.."))
2121

22+
import datetime
23+
2224
DEBUG = True
2325
TEMPLATE_DEBUG = DEBUG
2426

@@ -362,14 +364,15 @@ def skip_unreadable_post(record):
362364
IDSUBMIT_ANNOUNCE_FROM_EMAIL = 'internet-drafts@ietf.org'
363365
IDSUBMIT_ANNOUNCE_LIST_EMAIL = 'i-d-announce@ietf.org'
364366

365-
FIRST_CUTOFF_DAYS = 19 # Days from meeting to cut off dates on submit
366-
SECOND_CUTOFF_DAYS = 12
367-
CUTOFF_HOUR = 00 # midnight UTC
368-
CUTOFF_WARNING_DAYS = 21 # Number of days before cutoff to start showing the cutoff date
367+
# Days from meeting to day of cut off dates on submit -- cutoff_time_utc is added to this
368+
IDSUBMIT_DEFAULT_CUTOFF_DAY_OFFSET_00 = 20
369+
IDSUBMIT_DEFAULT_CUTOFF_DAY_OFFSET_01 = 13
370+
IDSUBMIT_DEFAULT_CUTOFF_TIME_UTC = datetime.timedelta(hours=23, minutes=59, seconds=59)
371+
IDSUBMIT_DEFAULT_CUTOFF_WARNING_DAYS = datetime.timedelta(days=21)
369372

370-
SUBMISSION_START_DAYS = -90
371-
SUBMISSION_CUTOFF_DAYS = 33
372-
SUBMISSION_CORRECTION_DAYS = 52
373+
MEETING_MATERIALS_SUBMISSION_START_DAYS = -90
374+
MEETING_MATERIALS_SUBMISSION_CUTOFF_DAYS = 33
375+
MEETING_MATERIALS_SUBMISSION_CORRECTION_DAYS = 52
373376

374377
INTERNET_DRAFT_DAYS_TO_EXPIRE = 185
375378

ietf/submit/forms.py

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import datetime
3+
import pytz
34

45
from django import forms
56
from django.conf import settings
@@ -40,29 +41,36 @@ def __init__(self, request, *args, **kwargs):
4041
self.parsed_draft = None
4142

4243
def set_cutoff_warnings(self):
43-
from datetime import timedelta
44-
now = datetime.datetime.utcnow()
45-
first_cut_off = Meeting.get_first_cut_off()
46-
second_cut_off = Meeting.get_second_cut_off()
47-
ietf_monday = Meeting.get_ietf_monday()
48-
49-
if now.date() >= (first_cut_off-timedelta(days=settings.CUTOFF_WARNING_DAYS)) and now.date() < first_cut_off:
50-
self.cutoff_warning = ( 'The pre-meeting cut-off date for new documents (i.e., version -00 Internet-Drafts) is %s at %02sh UTC.<br/>' % (first_cut_off, settings.CUTOFF_HOUR) +
51-
'The pre-meeting cut-off date for revisions to existing documents is %s at %02sh UTC.<br/>' % (second_cut_off, settings.CUTOFF_HOUR) )
52-
elif now.date() >= first_cut_off and now.date() < second_cut_off: # We are in the first_cut_off
53-
if now.date() == first_cut_off and now.hour < settings.CUTOFF_HOUR:
54-
self.cutoff_warning = 'The pre-meeting cut-off date for new documents (i.e., version -00 Internet-Drafts) is %s, at %02sh UTC. After that, you will not be able to submit a new document until %s, at %sh UTC' % (first_cut_off, settings.CUTOFF_HOUR, ietf_monday, settings.CUTOFF_HOUR, )
44+
now = datetime.datetime.now(pytz.utc)
45+
meeting = Meeting.get_current_meeting()
46+
#
47+
cutoff_00 = meeting.get_00_cutoff()
48+
cutoff_01 = meeting.get_01_cutoff()
49+
reopen = meeting.get_reopen_time()
50+
#
51+
cutoff_00_str = cutoff_00.strftime("%Y-%m-%d %H:%M %Z")
52+
cutoff_01_str = cutoff_01.strftime("%Y-%m-%d %H:%M %Z")
53+
reopen_str = reopen.strftime("%Y-%m-%d %H:%M %Z")
54+
if now.date() >= (cutoff_00.date() - meeting.idsubmit_cutoff_warning_days) and now <= cutoff_00:
55+
self.cutoff_warning = ( 'The last submission time for new documents (i.e., version -00 Internet-Drafts) before %s is %s.<br/><br/>' % (meeting, cutoff_00_str) +
56+
'The last submission time for revisions to existing documents before %s is %s.<br/>' % (meeting, cutoff_01_str) )
57+
elif now.date() >= cutoff_00.date() and now <= cutoff_01:
58+
# We are in the first_cut_off
59+
if now < cutoff_00:
60+
self.cutoff_warning = (
61+
'The last submission time for new documents (i.e., version -00 Internet-Drafts) before the meeting is %s.<br/>'
62+
'After that, you will not be able to submit a new document until after %s (IETF-meeting local time)' % (cutoff_00_str, reopen_str, ))
5563
else: # No 00 version allowed
56-
self.cutoff_warning = 'The pre-meeting cut-off date for new documents (i.e., version -00 Internet-Drafts) was %s at %sh UTC. You will not be able to submit a new document until %s, at %sh UTC.<br>You can still submit a version -01 or higher Internet-Draft until %sh UTC, %s' % (first_cut_off, settings.CUTOFF_HOUR, ietf_monday, settings.CUTOFF_HOUR, settings.CUTOFF_HOUR, second_cut_off, )
64+
self.cutoff_warning = (
65+
'The last submission time for new documents (i.e., version -00 Internet-Drafts) was %s.<br/>'
66+
'You will not be able to submit a new document until after %s (IETF-meeting local time).<br/><br>'
67+
'You can still submit a version -01 or higher Internet-Draft until %s' % (cutoff_00_str, reopen_str, cutoff_01_str, ))
5768
self.in_first_cut_off = True
58-
elif now.date() >= second_cut_off and now.date() < ietf_monday:
59-
if now.date() == second_cut_off and now.hour < settings.CUTOFF_HOUR: # We are in the first_cut_off yet
60-
self.cutoff_warning = 'The pre-meeting cut-off date for new documents (i.e., version -00 Internet-Drafts) was %s at %02sh UTC. You will not be able to submit a new document until %s, at %02sh UTC.<br>The I-D submission tool will be shut down at %02sh UTC today, and reopened at %02sh UTC on %s' % (first_cut_off, settings.CUTOFF_HOUR, ietf_monday, settings.CUTOFF_HOUR, settings.CUTOFF_HOUR, settings.CUTOFF_HOUR, ietf_monday)
61-
self.in_first_cut_off = True
62-
else: # Completely shut down of the tool
63-
self.cutoff_warning = 'The cut-off time for the I-D submission was %02dh UTC, %s.<br>The I-D submission tool will be reopened at %02dh local time at the IETF meeting location, %s.' % (settings.CUTOFF_HOUR, second_cut_off, settings.CUTOFF_HOUR, ietf_monday)
64-
self.shutdown = True
65-
69+
elif now > cutoff_01 and now < reopen:
70+
self.cutoff_warning = (
71+
'The last submission time for the I-D submission was %s.<br/><br>'
72+
'The I-D submission tool will be reopened after %s (IETF-meeting local time).' % (cutoff_01_str, reopen_str))
73+
self.shutdown = True
6674
def clean_file(self, field_name, parser_class):
6775
f = self.cleaned_data[field_name]
6876
if not f:

0 commit comments

Comments
 (0)