2 Commits
4.5.1 ... main

Author SHA1 Message Date
290d79ef5e Changed how time are sent to frontend during sync
All checks were successful
Build / build (push) Successful in 40s
2025-11-15 14:55:03 +01:00
aa0b8275e7 Fix so that ending slash doesn't matter for characters path
All checks were successful
Build / build (push) Successful in 40s
2025-11-08 12:04:44 +01:00
3 changed files with 13 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
package backend
import (
"fmt"
"log"
"os"
"strings"
@@ -8,6 +9,10 @@ import (
func GetCharacterList() []string {
charactersPath := os.Getenv("CHARACTERS_PATH")
fmt.Printf("dir: %s\n", charactersPath)
if !strings.HasSuffix(charactersPath, "/") {
charactersPath += "/"
}
files, err := os.ReadDir(charactersPath)
if err != nil {
log.Fatal(err)
@@ -24,7 +29,11 @@ func GetCharacterList() []string {
func GetCharacter(character string) string {
charactersPath := os.Getenv("CHARACTERS_PATH")
return charactersPath + "/" + character
fmt.Printf("dir: %s\n", charactersPath)
if !strings.HasSuffix(charactersPath, "/") {
charactersPath += "/"
}
return charactersPath + character
}
func isImage(entry os.DirEntry) bool {

View File

@@ -87,11 +87,11 @@ func SyncProgress() ProgressResponse {
timeSpent = currentTime.Sub(start)
out := time.Time{}.Add(timeSpent)
fmt.Printf("\nTime spent: %v\n", timeSpent)
fmt.Printf("Total time: %v\n", out.Format("15:04:05.00000"))
fmt.Printf("Time spent: %v\n", out.Format("15:04:05.00000"))
log.Printf("Progress: %v/%v %v%%\n", int(foldersSynced), int(numberOfFoldersToSync), progress)
return ProgressResponse{
Progress: fmt.Sprintf("%v", progress),
TimeSpent: fmt.Sprintf("%v", timeSpent),
TimeSpent: out.Format("15:04:05"),
}
}
@@ -171,7 +171,7 @@ func SyncResult() SyncResponse {
GamesChangedContent: gamesChangedContent,
GamesRemoved: gamesRemoved,
CatchedErrors: catchedErrors,
TotalTime: fmt.Sprintf("%v", timeSpent),
TotalTime: out.Format("15:04:05"),
}
}

View File

@@ -46,7 +46,6 @@ func InitDB(host string, port string, user string, password string, dbname strin
_, _ = fmt.Fprintf(os.Stderr, "QueryRow failed: %v\n", err)
os.Exit(1)
}
Testf()
fmt.Println(success)
}