timetable-extension #1
@ -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
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user