@@ -149,10 +149,10 @@ func (e eventsLogic) setupWebToolsTimer() {
149
149
now := time .Now ().In (location )
150
150
log .Printf ("setupWebToolsTimer -> now - hours:%d minutes:%d seconds:%d\n " , now .Hour (), now .Minute (), now .Second ())
151
151
152
- nowSecondsInDay := 60 * 60 * now .Hour () + 60 * now .Minute () + now .Second ()
153
- desiredMoment := 18000
152
+ // nowSecondsInDay := 60*60*now.Hour() + 60*now.Minute() + now.Second()
153
+ // desiredMoment := 18000
154
154
155
- var durationInSeconds int
155
+ /* var durationInSeconds int
156
156
log.Printf("setupWebToolsTimer -> nowSecondsInDay:%d desiredMoment:%d\n", nowSecondsInDay, desiredMoment)
157
157
if nowSecondsInDay <= desiredMoment {
158
158
log.Println("setupWebToolsTimer -> not web tools process today, so the first process will be today")
@@ -161,10 +161,10 @@ func (e eventsLogic) setupWebToolsTimer() {
161
161
log.Println("setupWebToolsTimer -> the web tools process has already been processed today, so the first process will be tomorrow")
162
162
leftToday := 86400 - nowSecondsInDay
163
163
durationInSeconds = leftToday + desiredMoment // the time which left today + desired moment from tomorrow
164
- }
164
+ }*/
165
165
//log.Println(durationInSeconds)
166
- // duration := time.Second * time.Duration(20 )
167
- duration := time .Second * time .Duration (durationInSeconds )
166
+ duration := time .Second * time .Duration (0 )
167
+ // duration := time.Second * time.Duration(durationInSeconds)
168
168
log .Printf ("setupWebToolsTimer -> first call after %s" , duration )
169
169
170
170
e .dailyWebToolsTimer = time .NewTimer (duration )
@@ -455,11 +455,16 @@ func (e eventsLogic) constructLegacyEvents(g model.WebToolsEvent) model.LegacyEv
455
455
outlookUrl := fmt .Sprintf ("https://calendars.illinois.edu/outlook2010/%s/%s.ics" , g .CalendarID , g .EventID )
456
456
457
457
recurrenceID , _ := recurenceIDtoInt (g .RecurrenceID )
458
+ location := locationToDef (g .Location )
459
+ con := model.ContactLegacy {ContactName : g .CalendarName , ContactEmail : g .ContactEmail , ContactPhone : g .ContactName }
460
+ var contacts []model.ContactLegacy
461
+ contacts = append (contacts , con )
462
+ contatsLegacy := contactsToDef (contacts )
458
463
459
464
return model.LegacyEvent {Category : g .EventType , OriginatingCalendarID : g .OriginatingCalendarID , IsVirtial : isVirtual , DataModified : g .EventID ,
460
465
Sponsor : g .Sponsor , Title : g .Title , CalendarID : g .CalendarID , SourceID : "0" , AllDay : false , IsEventFree : costFree , LongDescription : g .Description ,
461
466
TitleURL : g .TitleURL , RegistrationURL : g .RegistrationURL , RecurringFlag : Recurrence , IcalURL : icalUrl , OutlookURL : outlookUrl ,
462
- RecurrenceID : recurrenceID }
467
+ RecurrenceID : recurrenceID , Location : & location , Contacts : contatsLegacy }
463
468
}
464
469
465
470
func recurenceIDtoInt (s string ) (* int , error ) {
@@ -476,6 +481,23 @@ func recurenceIDtoInt(s string) (*int, error) {
476
481
return result , nil
477
482
}
478
483
484
+ // Location
485
+ func locationToDef (location string ) model.LocationLegacy {
486
+ return model.LocationLegacy {Description : location }
487
+ }
488
+
489
+ // Contacts
490
+ func contactToDef (items model.ContactLegacy ) model.ContactLegacy {
491
+ return model.ContactLegacy {ContactName : items .ContactName , ContactEmail : items .ContactEmail , ContactPhone : items .ContactPhone }
492
+ }
493
+ func contactsToDef (items []model.ContactLegacy ) []model.ContactLegacy {
494
+ defs := make ([]model.ContactLegacy , len (items ))
495
+ for index := range items {
496
+ defs [index ] = contactToDef (items [index ])
497
+ }
498
+ return defs
499
+ }
500
+
479
501
// newAppEventsLogic creates new appShared
480
502
func newAppEventsLogic (app * Application , eventsBBAdapter EventsBBAdapter , logger logs.Logger ) eventsLogic {
481
503
timerDone := make (chan bool )
0 commit comments