Barely anything done because Lucy will not sleep.

This commit is contained in:
Fred Boniface 2024-04-02 21:07:01 +01:00
parent 3251b9a7bb
commit 2374a3ca37
3 changed files with 15 additions and 1 deletions

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)