timetable-extension #1

Open
fred.boniface wants to merge 160 commits from timetable-extension into main
3 changed files with 15 additions and 1 deletions
Showing only changes of commit 2374a3ca37 - Show all commits

View File

@ -41,7 +41,7 @@ func parseMetadata(metadata *dbAccess.CifMetadata, cfg *helpers.Configuration) e
}
log.Msg.Debug("Requesting CIF Data Update")
newMeta, err := runUpdate("daily", metadata)
newMeta, err := runUpdate(metadata, cfg)
if err != nil {
return err
}

View File

@ -1,5 +1,16 @@
package cif
import (
"git.fjla.uk/owlboard/go-types/pkg/upstreamApi"
"git.fjla.uk/owlboard/timetable-mgr/dbAccess"
)
// Probably looking to return some kind of array, containing the database actions. Associations aren't needed at the moment.
// however, maybe I need to process them too. I need to plan how to return the data properly.
func parseCifData(data []byte, metadata *dbAccess.CifMetadata) (*[]upstreamApi.CifScheduleSegment, error) {
return nil, nil
}
// Handles documents from CIF and VSTP Feeds.
// Takes in individual documents, and returns them in the correct format for the Database
// Uses types declared in owlboard/go-types/db

View File

@ -55,6 +55,7 @@ func runUpdate(metadata *dbAccess.CifMetadata, cfg *helpers.Configuration) (*dbA
newMeta, err := runFullUpdate(cfg)
if err != nil {
log.Msg.Error("CIF Update failed", zap.Error(err))
return nil, err
}
return newMeta, nil
}
@ -72,6 +73,8 @@ func runUpdate(metadata *dbAccess.CifMetadata, cfg *helpers.Configuration) (*dbA
return dates[i].Before(dates[j])
})
log.Msg.Info("Updating CIF Data", zap.Any("dates to update", dates))
// Iterate over each date, fetching then parsing the data
for _, date := range dates {
data, err := fetchUpdate(date, cfg)