timetable-extension #1

Open
fred.boniface wants to merge 160 commits from timetable-extension into main
2 changed files with 24 additions and 2 deletions
Showing only changes of commit 5f57e1d267 - Show all commits

View File

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

View File

@ -3,6 +3,7 @@ package pis
import (
"archive/tar"
"compress/gzip"
"encoding/json"
"fmt"
"io"
"net/http"
@ -52,7 +53,7 @@ func runUpdate(tarballUrl string) error {
}
log.Info("Loaded PIS Files to Slice")
fmt.Println(&pisSlice)
DEBUG_saveSliceToFile(*pisSlice, "pis_out.json")
/*
err = dbAccess.DropCollection(dbAccess.PisCollection)
if err != nil {
@ -197,3 +198,24 @@ func cleanupFiles(paths ...string) {
}
log.Info("Removed PIS Release files")
}
// Saves pisSlice to file
func DEBUG_saveSliceToFile(pisSlice interface{}, filename string) error {
data, err := json.MarshalIndent(pisSlice, "", " ")
if err != nil {
return fmt.Errorf("error marshalling slice to JSON: %v", err)
}
file, err := os.Create(filename)
if err != nil {
return fmt.Errorf("error creating file: %v", err)
}
defer file.Close()
_, err = file.Write(data)
if err != nil {
return fmt.Errorf("error writing JSON to file: %v", err)
}
return nil
}