Compare commits

..

No commits in common. "28995790cce0dcfc5c36e1751695e746dae281ae" and "e15992e86582e751ece597a97b60cddc254028d9" have entirely different histories.

5 changed files with 10 additions and 21 deletions

View File

@ -5,7 +5,7 @@ import (
) )
// Version Constants // Version Constants
const versionNum string = "2024.10.2" const versionNum string = "2024.10.1"
const versionSuffix string = "" const versionSuffix string = ""
const Version string = versionNum + versionSuffix const Version string = versionNum + versionSuffix

View File

@ -16,7 +16,6 @@ import (
"git.fjla.uk/owlboard/timetable-mgr/helpers" "git.fjla.uk/owlboard/timetable-mgr/helpers"
"git.fjla.uk/owlboard/timetable-mgr/log" "git.fjla.uk/owlboard/timetable-mgr/log"
"git.fjla.uk/owlboard/timetable-mgr/messaging" "git.fjla.uk/owlboard/timetable-mgr/messaging"
"git.fjla.uk/owlboard/timetable-mgr/pis"
"git.fjla.uk/owlboard/timetable-mgr/stations" "git.fjla.uk/owlboard/timetable-mgr/stations"
"git.fjla.uk/owlboard/timetable-mgr/vstp" "git.fjla.uk/owlboard/timetable-mgr/vstp"
"go.uber.org/zap" "go.uber.org/zap"
@ -67,7 +66,6 @@ func main() {
go cif.CheckCif(cfg) go cif.CheckCif(cfg)
go corpus.CheckCorpus(cfg) go corpus.CheckCorpus(cfg)
go stations.Check() go stations.Check()
go pis.Check()
if cfg.VstpOn { if cfg.VstpOn {
messaging.StompInit(cfg) messaging.StompInit(cfg)

View File

@ -14,27 +14,21 @@ import (
// Process the YAML data to a struct // Process the YAML data to a struct
func processYaml(yamlStr string) (*[]database.PIS, error) { func processYaml(yamlStr string) (*[]database.PIS, error) {
// Define 'container' struct var pis []PisData
var pisData struct {
Pis []PisData `yaml:"pis"`
}
// Unmarshal the YAML data into the structure // Unmarshal the YAML data into a slice of PisData
err := yaml.Unmarshal([]byte(yamlStr), &pisData) err := yaml.Unmarshal([]byte(yamlStr), &pis)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to unmarshal YAML: %v", err) return nil, fmt.Errorf("failed to unmarshal YAML: %v", err)
} }
// Perform deduplication on the entire pis slice // Perform deduplication on the entire pis slice
err = deduplicateCodes(&pisData.Pis) err = deduplicateCodes(&pis)
if err != nil { if err != nil {
return nil, err return nil, err
} }
documents, err := convertPisForDatabase(&pisData.Pis) documents, err := convertPisForDatabase(&pis)
if err != nil {
return nil, err
}
return documents, nil return documents, nil
} }

View File

@ -9,9 +9,6 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
"git.fjla.uk/owlboard/timetable-mgr/log"
"go.uber.org/zap"
) )
const ( const (
@ -130,7 +127,7 @@ func extractFiles(gzipStream io.Reader, dest string) error {
} }
outFile.Close() outFile.Close()
default: default:
log.Warn("Unable to handle filetype", zap.String("Typeflag", string(header.Typeflag)), zap.String("Filename", header.Name)) fmt.Printf("Unable to handle filetype %c in %s\n", header.Typeflag, header.Name)
} }
} }
return nil return nil
@ -148,7 +145,7 @@ func extractYamlData(dir string) (string, error) {
// Check if the path contains 'pis' and has a .yaml or .yml extension // Check if the path contains 'pis' and has a .yaml or .yml extension
if strings.Contains(path, "/pis/") && !info.IsDir() && if strings.Contains(path, "/pis/") && !info.IsDir() &&
(strings.HasSuffix(info.Name(), ".yaml") || strings.HasSuffix(info.Name(), ".yml")) { (strings.HasSuffix(info.Name(), ".yaml") || strings.HasSuffix(info.Name(), ".yml")) {
log.Debug("Processing YAML", zap.String("directory", path)) fmt.Printf("Processing YAML file in 'pis' directory: %s\n", path)
file, err := os.Open(path) file, err := os.Open(path)
if err != nil { if err != nil {
@ -182,7 +179,7 @@ func cleanupFiles(paths ...string) {
for _, path := range paths { for _, path := range paths {
err := os.RemoveAll(path) err := os.RemoveAll(path)
if err != nil { if err != nil {
log.Warn("Error removing file", zap.String("path", path), zap.Error(err)) fmt.Printf("Error removing %s: %v\n", path, err)
} }
} }
} }

View File

@ -48,7 +48,7 @@ func Subscribe() {
log.Error("VSTP Message Error", zap.Error(msg.Err)) log.Error("VSTP Message Error", zap.Error(msg.Err))
} else { } else {
if msg != nil { if msg != nil {
log.Debug("VSTP Message Received") log.Info("VSTP Message Received")
handle(msg) handle(msg)
} else { } else {
log.Info("VSTP Message Empty") log.Info("VSTP Message Empty")