[CODE] add speaker from CSV
This commit is contained in:
parent
e5b29648c0
commit
6036936df4
13
main.go
13
main.go
|
@ -97,8 +97,6 @@ func main() {
|
||||||
// omit title row
|
// omit title row
|
||||||
csvRecords := records[1:]
|
csvRecords := records[1:]
|
||||||
|
|
||||||
// fmt.Println(csvRecords) // TODO
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Data Conversion
|
* Data Conversion
|
||||||
*/
|
*/
|
||||||
|
@ -144,11 +142,10 @@ func main() {
|
||||||
// convert csv entries into event and sort in days
|
// convert csv entries into event and sort in days
|
||||||
events := make(map[int][]event) // map of day index to day's events
|
events := make(map[int][]event) // map of day index to day's events
|
||||||
eventID := 100
|
eventID := 100
|
||||||
|
speakerID := 1
|
||||||
confDays := make(map[int]day) // map of day index to day structure
|
confDays := make(map[int]day) // map of day index to day structure
|
||||||
|
|
||||||
for idx, row := range csvRecords {
|
for idx, row := range csvRecords {
|
||||||
// TODO: add speakers
|
|
||||||
|
|
||||||
eventStart, err := time.ParseInLocation(timeCSVFormat, row[csvColStart], loc)
|
eventStart, err := time.ParseInLocation(timeCSVFormat, row[csvColStart], loc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("Error parsing start date in CSV file, line ", idx+1, ":\n", err)
|
log.Fatal("Error parsing start date in CSV file, line ", idx+1, ":\n", err)
|
||||||
|
@ -158,13 +155,19 @@ func main() {
|
||||||
log.Fatal("Error parsing end date in CSV file, line ", idx+1, ":\n", err)
|
log.Fatal("Error parsing end date in CSV file, line ", idx+1, ":\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create event struct and sort into day map
|
||||||
|
var eventSpeaker []person
|
||||||
|
if row[csvColSpeaker] != "" {
|
||||||
|
eventSpeaker = append(eventSpeaker, person{speakerID, row[csvColSpeaker]})
|
||||||
|
}
|
||||||
|
|
||||||
dayIdx := int(eventStart.Sub(conferenceStart).Hours()/24) + 1
|
dayIdx := int(eventStart.Sub(conferenceStart).Hours()/24) + 1
|
||||||
eventGUID := strconv.Itoa(dayIdx) + "-" + strconv.Itoa(eventID)
|
eventGUID := strconv.Itoa(dayIdx) + "-" + strconv.Itoa(eventID)
|
||||||
eventDateStr := eventStart.Format(time.RFC3339)
|
eventDateStr := eventStart.Format(time.RFC3339)
|
||||||
eventStartStr := eventStart.Format(timeXMLTimeFormat)
|
eventStartStr := eventStart.Format(timeXMLTimeFormat)
|
||||||
eventDurationStr := fmtDuration(eventEnd.Sub(eventStart))
|
eventDurationStr := fmtDuration(eventEnd.Sub(eventStart))
|
||||||
|
|
||||||
events[dayIdx] = append(events[dayIdx], event{eventID, eventGUID, row[csvColRoom], row[csvColTitle], eventDateStr, eventStartStr, eventDurationStr, row[csvColLang], nil})
|
events[dayIdx] = append(events[dayIdx], event{eventID, eventGUID, row[csvColRoom], row[csvColTitle], eventDateStr, eventStartStr, eventDurationStr, row[csvColLang], eventSpeaker})
|
||||||
|
|
||||||
// create days
|
// create days
|
||||||
if _, ok := confDays[dayIdx]; !ok {
|
if _, ok := confDays[dayIdx]; !ok {
|
||||||
|
|
28
schedule.csv
28
schedule.csv
|
@ -1,14 +1,16 @@
|
||||||
Titel des Programmpunktes;Raum;Von (TT.MM.JJ HH:MM);Bis (TT.MM.JJ HH:MM);Vortragende;Sprache (DE/EN)
|
Titel des Programmpunktes;Raum;Von (TT.MM.JJ HH:MM);Bis (TT.MM.JJ HH:MM);Vortragende;Sprache (DE/EN)
|
||||||
Begrüßung;Holzhafen;25.11.18 12:00;25.11.18 13:00;Ada Lovelace;EN
|
Begrüßung;Holzhafen;25.11.18 15:45;25.11.18 17:00;Ada Lovelace;EN
|
||||||
Vortrag 1;Raackmoor;25.11.18 12:00;25.11.18 13:00;Marie Curie;
|
itte tragen Sie Ihre Programmpunkte hier ein;Raackmoor;25.11.18 15:45;25.11.18 17:00;Marie Curie;
|
||||||
Noch ein Vortrag;Wohldorfer Wald;25.11.18 12:00;25.11.18 13:00;Donna Strickland;
|
Der Titel sollte max. ca. 45 Zeichen haben oder 50;Wohldorfer Wald;25.11.18 15:45;25.11.18 17:00;Donna Strickland;
|
||||||
Workshop;Heuckenlock;25.11.18 12:00;25.11.18 13:00;Edith Clarke;
|
Die möglichen Räume sind hier alle aufgeführt;Heuckenlock;25.11.18 15:45;25.11.18 17:00;Edith Clarke;
|
||||||
Testvortrag Ebbe;Heuckenlock Ebbe;25.11.18 12:00;25.11.18 13:00;Bjarne Stroustrup;
|
Testvortrag Ebbe;Heuckenlock Ebbe;25.11.18 15:45;25.11.18 17:00;Bjarne Stroustrup;
|
||||||
Testvortrag Flut;Heuckenlock Flut;25.11.18 12:00;25.11.18 13:00;Chris Lattner;
|
Testvortrag Flut;Heuckenlock Flut;25.11.18 15:45;25.11.18 17:00;Chris Lattner, Someone else;
|
||||||
Test 1;Holzhafen;25.11.18 13:00;25.11.18 13:30;;
|
Kaffeebuffet vor den Räumen (auf der Empore);Empore;25.11.18 15:45;25.11.18 17:00;;
|
||||||
Test 2;Raackmoor;25.11.18 13:00;25.11.18 13:30;;
|
Essen;Restaurant;25.11.18 15:45;25.11.18 17:00;;
|
||||||
Test 3;Wohldorfer Wald;25.11.18 13:00;25.11.18 13:30;;
|
Test 1 mit einem langen Titel;Holzhafen;25.11.18 17:00;25.11.18 17:30;;
|
||||||
Test 4;Heuckenlock;25.11.18 13:00;25.11.18 13:30;;
|
Test 2 mit einem noch längeren Titel des Talks;Raackmoor;25.11.18 17:00;25.11.18 17:30;;
|
||||||
Test 5;Heuckenlock Ebbe;25.11.18 13:00;25.11.18 13:30;;
|
Test 3;Wohldorfer Wald;25.11.18 17:00;25.11.18 17:30;;
|
||||||
Test 6;Heuckenlock Flut;25.11.18 13:00;25.11.18 13:30;;
|
Test 4;Heuckenlock;25.11.18 17:00;25.11.18 17:30;;
|
||||||
Test 7;Heuckenlock Flut;24.11.18 13:00;24.11.18 13:30;;
|
Test 5;Heuckenlock Ebbe;25.11.18 17:00;25.11.18 17:30;;
|
||||||
|
Test 6;Heuckenlock Flut;25.11.18 17:00;25.11.18 17:30;;
|
||||||
|
Test 7;Heuckenlock Flut;24.11.18 17:00;24.11.18 17:30;;
|
|
Loading…
Reference in a new issue