sync: Peak a deterministic ID if 0

This commit is contained in:
nemunaire 2024-03-18 10:34:42 +01:00
parent 85ab183bed
commit 35d07c1aa4

View file

@ -3,6 +3,7 @@ package sync
import ( import (
"bytes" "bytes"
"fmt" "fmt"
"hash/adler32"
"image" "image"
"net/http" "net/http"
"net/url" "net/url"
@ -88,6 +89,11 @@ func parseExerciceDirname(edir string) (eid int, ename string, err error) {
return return
} }
// ID 0: peak a deterministic-random-ordered ID instead
if eid == 0 {
eid = int(adler32.Checksum([]byte(edir_splt[1])))
}
ename = edir_splt[1] ename = edir_splt[1]
return return