timetable-extension #1
@ -20,6 +20,8 @@ func Check() {
 | 
			
		||||
 | 
			
		||||
	apiUrl := fmt.Sprintf("%s/api/v1/repos/%s/%s/releases/latest", baseUrl, repoOwner, repoName)
 | 
			
		||||
 | 
			
		||||
	log.Info("Initiating PIS Check")
 | 
			
		||||
 | 
			
		||||
	resp, err := http.Get(apiUrl)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error("Error GETting Gitea API", zap.Error(err))
 | 
			
		||||
 | 
			
		||||
@ -9,10 +9,6 @@ import (
 | 
			
		||||
	"os"
 | 
			
		||||
	"path/filepath"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"git.fjla.uk/owlboard/timetable-mgr/dbAccess"
 | 
			
		||||
	"git.fjla.uk/owlboard/timetable-mgr/log"
 | 
			
		||||
	"go.uber.org/zap"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
const (
 | 
			
		||||
@ -50,24 +46,24 @@ func runUpdate(tarballUrl string) error {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fmt.Println(&pisSlice)
 | 
			
		||||
	/*
 | 
			
		||||
		err = dbAccess.DropCollection(dbAccess.PisCollection)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	err = dbAccess.DropCollection(dbAccess.PisCollection)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
		count, err := dbAccess.PutPisData(pisSlice)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return err
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	count, err := dbAccess.PutPisData(pisSlice)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	log.Info("Insterted new PIS Data", zap.Int64("PIS Codes", count))
 | 
			
		||||
 | 
			
		||||
	err = dbAccess.CreatePisIndeces()
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error("Failed to create PIS Indeces, poor performance expected", zap.Error(err))
 | 
			
		||||
	}
 | 
			
		||||
		log.Info("Insterted new PIS Data", zap.Int64("PIS Codes", count))
 | 
			
		||||
 | 
			
		||||
		err = dbAccess.CreatePisIndeces()
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			log.Error("Failed to create PIS Indeces, poor performance expected", zap.Error(err))
 | 
			
		||||
		}
 | 
			
		||||
	*/
 | 
			
		||||
	// Cleanup files
 | 
			
		||||
	cleanupFiles(destPath, extractPath)
 | 
			
		||||
	return nil
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user