parent
14f5baf77c
commit
098c7e4447
9 changed files with 464 additions and 66 deletions
|
|
@ -268,20 +268,13 @@ def check_trains() -> None:
|
|||
print(len(trains), "trains")
|
||||
|
||||
|
||||
def check_conference_dates(conf: agenda.conference.Conference) -> None:
|
||||
def check_conference_dates(conf_data: agenda.types.StrDict) -> None:
|
||||
"""Check conference start/end range."""
|
||||
if normalize_datetime(conf.start) > normalize_datetime(conf.end):
|
||||
pprint(conf)
|
||||
print(f"conference {conf.name!r} ends before it starts")
|
||||
sys.exit(-1)
|
||||
|
||||
duration = (agenda.utils.as_date(conf.end) - agenda.utils.as_date(conf.start)).days
|
||||
if duration >= agenda.conference.MAX_CONF_DAYS:
|
||||
pprint(conf)
|
||||
print(
|
||||
f"conference {conf.name!r} is {duration} days; "
|
||||
+ f"maximum is {agenda.conference.MAX_CONF_DAYS - 1}"
|
||||
)
|
||||
try:
|
||||
agenda.conference.validate_conference_date_fields(conf_data)
|
||||
except ValueError as exc:
|
||||
pprint(conf_data)
|
||||
print(f"conference {conf_data.get('name', '[unknown]')!r}: {exc}")
|
||||
sys.exit(-1)
|
||||
|
||||
|
||||
|
|
@ -303,9 +296,10 @@ def check_conferences() -> None:
|
|||
sys.exit(-1)
|
||||
|
||||
check_country_code(conf_data, "conference", required=False)
|
||||
check_conference_dates(conf)
|
||||
check_conference_dates(conf_data)
|
||||
|
||||
current_start = normalize_datetime(conf_data["start"])
|
||||
date_fields = agenda.conference.conference_date_fields(conf_data)
|
||||
current_start = normalize_datetime(date_fields["sort_date"])
|
||||
if prev_start and current_start < prev_start:
|
||||
assert prev_conf_data is not None
|
||||
print(f"Out of order conference found:")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue