Skip to content

Commit

Permalink
Update csv import plugin to support presentation fields Fix Freeseer#675
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Romansky committed Dec 18, 2014
1 parent 872c68c commit 86ec04b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
27 changes: 19 additions & 8 deletions src/freeseer/framework/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,25 @@ def add_talks_from_csv(self, fname):

if presentations:
for presentation in presentations:
talk = Presentation(presentation["Title"],
presentation["Speaker"],
presentation["Abstract"], # Description
presentation["Level"],
presentation["Event"],
presentation["Room"],
presentation["Time"],
presentation["Time"])
if presentation['Time'] != '':
talk = Presentation(presentation["Title"],
presentation["Speaker"],
presentation["Abstract"], # Description
presentation["Level"],
presentation["Event"],
presentation["Room"],
presentation["Time"],
presentation["Time"]) # Presentation using legacy time field
else:
talk = Presentation(presentation["Title"],
presentation["Speaker"],
presentation["Abstract"], # Description
presentation["Level"],
presentation["Event"],
presentation["Room"],
presentation["Date"],
presentation["StartTime"],
presentation["EndTime"])
self.insert_presentation(talk)

else:
Expand Down
5 changes: 4 additions & 1 deletion src/freeseer/plugins/importer/csv_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@ def get_presentations(self, fname):
'Level': unicode(row.get('Level', ''), 'utf-8'),
'Event': unicode(row.get('Event', ''), 'utf-8'),
'Room': unicode(row.get('Room', ''), 'utf-8'),
'Time': unicode(row.get('Time', ''), 'utf-8')
'Time': unicode(row.get('Time', ''), 'utf-8'), # Legacy csv time field
'Date': unicode(row.get('Date', ''), 'utf-8'),
'StartTime': unicode(row.get('StartTime', ''), 'utf-8'),
'EndTime': unicode(row.get('EndTime', ''), 'utf-8')
}

presentations.append(talk)
Expand Down

0 comments on commit 86ec04b

Please sign in to comment.