Skip to content

Commit d774784

Browse files
Merge pull request #15 from PyconUK/proposals
Import all proposals and use event_type to control scheduling
2 parents e6afb63 + 07e06e6 commit d774784

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

src/scheduler/define.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313

1414
def resources():
1515
resources = io.import_yaml(session.folders['input'])
16-
resources['events'] = io.import_proposals(
17-
resources, session.folders['input'])
16+
proposals = io.import_proposals(resources, session.folders['input'])
17+
resources['proposals'] = proposals
18+
resources['events'] = [
19+
p for p in proposals if p['event_type'] in resources['event_types']]
1820
return resources
1921

2022

src/scheduler/io.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,15 @@ def import_proposals(resources, input_folder):
3434
with Path(input_folder, 'proposals.csv').open('r') as file:
3535
reader = csv.DictReader(file)
3636
for row in reader:
37-
if row['session_type'] in resources['event_types']:
38-
event_type = row['session_type']
39-
proposals.append({
40-
'title': row['title'],
41-
'duration': int(row['duration']),
42-
'demand': float(row.get('demand', 0)),
43-
'person': slugify(row['name']),
44-
'tags': [row['tag']] if row['tag'] != '' else [],
45-
'subtitle': row['subtitle'],
46-
'event_type': event_type})
37+
event_type = row['session_type']
38+
proposals.append({
39+
'title': row['title'],
40+
'duration': int(row['duration']),
41+
'demand': float(row.get('demand', 0)),
42+
'person': slugify(row['name']),
43+
'tags': [row['tag']] if row['tag'] != '' else [],
44+
'subtitle': row['subtitle'],
45+
'event_type': event_type})
4746
logger.debug(f'\nreources:\n{pformat(proposals)}')
4847
return proposals
4948

0 commit comments

Comments
 (0)