Fix classifier version for new caps

This commit is contained in:
Christoph Hagen 2023-03-20 11:06:59 +01:00
parent e7a54ec8ec
commit 289e927c6a

View File

@ -71,10 +71,6 @@ final class CapServer {
} }
} }
var nextClassifierVersion: Int {
caps.values.compactMap { $0.classifierVersion }.max() ?? 1
}
var capCount: Int { var capCount: Int {
caps.count caps.count
} }
@ -469,7 +465,7 @@ final class CapServer {
} }
var cap = cap var cap = cap
cap.count = 0 cap.count = 0
cap.classifierVersion = nextClassifierVersion cap.classifierVersion = nil
caps[cap.id] = cap caps[cap.id] = cap
saveCapCountHTML() saveCapCountHTML()
updateGridCapCount() updateGridCapCount()
@ -547,6 +543,7 @@ final class CapServer {
.compactMap(Int.init) .compactMap(Int.init)
let version = classifierVersion let version = classifierVersion
for cap in trainedCaps { for cap in trainedCaps {
// Set current classifier
if caps[cap]?.classifierVersion == nil { if caps[cap]?.classifierVersion == nil {
caps[cap]?.classifierVersion = version caps[cap]?.classifierVersion = version
} }