fixing cutoff logic on submission. Closes .

- Legacy-Id: 2817
This commit is contained in:
Jacobo Tarragón 2011-02-07 17:08:33 +00:00
parent 4bc95f6436
commit c0e1084a20
4 changed files with 27 additions and 42 deletions

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2007, All Rights Reserved
from django.db import models
from django.conf import settings
from ietf.idtracker.models import Acronym, PersonOrOrgInfo, IRTF, AreaGroup, Area, IETFWG
import datetime
#from ietf.utils import log
@ -141,7 +142,7 @@ class Meeting(models.Model):
overview1 = models.TextField(blank=True)
overview2 = models.TextField(blank=True)
def __str__(self):
return "IETF %s" % (self.meeting_num)
return "IETF %s" % (self.meeting_num)
def get_meeting_date (self,offset):
return self.start_date + datetime.timedelta(days=offset)
def num(self):
@ -149,6 +150,23 @@ class Meeting(models.Model):
class Meta:
db_table = 'meetings'
@classmethod
def get_first_cut_off(cls):
start_date = cls.objects.all().order_by('-start_date')[0].start_date
offset = datetime.timedelta(days=settings.FIRST_CUTOFF_DAYS)
return start_date - offset
@classmethod
def get_second_cut_off(cls):
start_date = cls.objects.all().order_by('-start_date')[0].start_date
offset = datetime.timedelta(days=settings.SECOND_CUTOFF_DAYS)
return start_date - offset
@classmethod
def get_ietf_monday(cls):
start_date = cls.objects.all().order_by('-start_date')[0].start_date
return start_date + datetime.timedelta(days=-start_date.weekday(), weeks=1)
class MeetingVenue(models.Model):
meeting_num = models.ForeignKey(Meeting, db_column='meeting_num', unique=True)
break_area_name = models.CharField(max_length=255)

View file

@ -188,6 +188,10 @@ LIAISON_UNIVERSAL_FROM = 'Liaison Statement Management Tool <lsmt@' + IETF_DOMAI
LIAISON_ATTACH_PATH = '/a/www/ietf-datatracker/documents/LIAISON/'
LIAISON_ATTACH_URL = '/documents/LIAISON/'
# Days from meeting to cut off dates on submit
FIRST_CUTOFF_DAYS = 5
SECOND_CUTOFF_DAYS = 3
# Put SECRET_KEY in here, or any other sensitive or site-specific
# changes. DO NOT commit settings_local.py to svn.
from settings_local import *

View file

@ -16,7 +16,7 @@ from ietf.liaisons.widgets import (FromWidget, ReadOnlyWidget, ButtonWidget,
ShowAttachmentsWidget, RelatedLiaisonWidget)
from ietf.submit.models import IdSubmitDateConfig
from ietf.proceedings.models import Meeting
from ietf.submit.parsers.plain_parser import PlainParser
from ietf.submit.parsers.pdf_parser import PDFParser
from ietf.submit.parsers.ps_parser import PSParser
@ -46,12 +46,9 @@ class UploadForm(forms.Form):
def read_dates(self):
now = datetime.datetime.now()
first_cut_off = IdSubmitDateConfig.get_first_cut_off()
second_cut_off = IdSubmitDateConfig.get_second_cut_off()
ietf_monday = IdSubmitDateConfig.get_ietf_monday()
processed_ids_date = IdSubmitDateConfig.get_processed_ids_date()
monday_after_ietf = IdSubmitDateConfig.get_monday_after_ietf()
list_aproved_date = IdSubmitDateConfig.get_list_aproved_date()
first_cut_off = Meeting.get_first_cut_off()
second_cut_off = Meeting.get_second_cut_off()
ietf_monday = Meeting.get_ietf_monday()
if now.date() >= first_cut_off and now.date() < second_cut_off: # We are in the first_cut_off
if now.date() == first_cut_off and now.hour < CUTOFF_HOUR:

View file

@ -6,37 +6,3 @@ class IdSubmissionStatus(models.Model):
class Meta:
db_table = 'id_submission_status'
class IdSubmitDateConfig(models.Model):
id = models.IntegerField(primary_key=True)
id_date = models.DateField(null=True, blank=True)
date_name = models.CharField(blank=True, max_length=255)
f_name = models.CharField(blank=True, max_length=255)
class Meta:
db_table = 'id_dates'
@classmethod
def get_first_cut_off(cls):
return cls.objects.get(id=1).id_date
@classmethod
def get_second_cut_off(cls):
return cls.objects.get(id=2).id_date
@classmethod
def get_ietf_monday(cls):
return cls.objects.get(id=3).id_date
@classmethod
def get_processed_ids_date(cls):
return cls.objects.get(id=4).id_date
@classmethod
def get_monday_after_ietf(cls):
return cls.objects.get(id=5).id_date
@classmethod
def get_list_aproved_date(cls):
return cls.objects.get(id=6).id_date