Fix generate task override behaviour (#3661)

This commit is contained in:
DingDongSoLong4
2023-05-03 05:42:25 +02:00
committed by GitHub
parent 1717474a81
commit 67a2161c62
9 changed files with 96 additions and 51 deletions

View File

@@ -22,7 +22,7 @@ func (t *GenerateInteractiveHeatmapSpeedTask) GetDescription() string {
}
func (t *GenerateInteractiveHeatmapSpeedTask) Start(ctx context.Context) {
if !t.shouldGenerate() {
if !t.required() {
return
}
@@ -52,13 +52,18 @@ func (t *GenerateInteractiveHeatmapSpeedTask) Start(ctx context.Context) {
}
}
func (t *GenerateInteractiveHeatmapSpeedTask) shouldGenerate() bool {
func (t *GenerateInteractiveHeatmapSpeedTask) required() bool {
primaryFile := t.Scene.Files.Primary()
if primaryFile == nil || !primaryFile.Interactive {
return false
}
if t.Overwrite {
return true
}
sceneHash := t.Scene.GetHash(t.fileNamingAlgorithm)
return !t.doesHeatmapExist(sceneHash) || primaryFile.InteractiveSpeed == nil || t.Overwrite
return !t.doesHeatmapExist(sceneHash) || primaryFile.InteractiveSpeed == nil
}
func (t *GenerateInteractiveHeatmapSpeedTask) doesHeatmapExist(sceneChecksum string) bool {