Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
WithoutPants committed Nov 12, 2024
1 parent a18c538 commit f1ca048
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions pkg/sqlite/criterion_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,20 +285,20 @@ func resolutionCriterionHandler(resolution *models.ResolutionCriterionInput, hei
addJoinFn(f)
}

min := resolution.Value.GetMinResolution()
max := resolution.Value.GetMaxResolution()
mn := resolution.Value.GetMinResolution()
mx := resolution.Value.GetMaxResolution()

widthHeight := fmt.Sprintf("MIN(%s, %s)", widthColumn, heightColumn)

switch resolution.Modifier {
case models.CriterionModifierEquals:
f.addWhere(fmt.Sprintf("%s BETWEEN %d AND %d", widthHeight, min, max))
f.addWhere(fmt.Sprintf("%s BETWEEN %d AND %d", widthHeight, mn, mx))
case models.CriterionModifierNotEquals:
f.addWhere(fmt.Sprintf("%s NOT BETWEEN %d AND %d", widthHeight, min, max))
f.addWhere(fmt.Sprintf("%s NOT BETWEEN %d AND %d", widthHeight, mn, mx))
case models.CriterionModifierLessThan:
f.addWhere(fmt.Sprintf("%s < %d", widthHeight, min))
f.addWhere(fmt.Sprintf("%s < %d", widthHeight, mn))
case models.CriterionModifierGreaterThan:
f.addWhere(fmt.Sprintf("%s > %d", widthHeight, max))
f.addWhere(fmt.Sprintf("%s > %d", widthHeight, mx))
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions pkg/sqlite/gallery_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,20 +414,20 @@ func (qb *galleryFilterHandler) averageResolutionCriterionHandler(resolution *mo
f.addLeftJoin("images_files", "", "images.id = images_files.image_id")
f.addLeftJoin("image_files", "", "images_files.file_id = image_files.file_id")

min := resolution.Value.GetMinResolution()
max := resolution.Value.GetMaxResolution()
mn := resolution.Value.GetMinResolution()
mx := resolution.Value.GetMaxResolution()

const widthHeight = "avg(MIN(image_files.width, image_files.height))"

switch resolution.Modifier {
case models.CriterionModifierEquals:
f.addHaving(fmt.Sprintf("%s BETWEEN %d AND %d", widthHeight, min, max))
f.addHaving(fmt.Sprintf("%s BETWEEN %d AND %d", widthHeight, mn, mx))
case models.CriterionModifierNotEquals:
f.addHaving(fmt.Sprintf("%s NOT BETWEEN %d AND %d", widthHeight, min, max))
f.addHaving(fmt.Sprintf("%s NOT BETWEEN %d AND %d", widthHeight, mn, mx))
case models.CriterionModifierLessThan:
f.addHaving(fmt.Sprintf("%s < %d", widthHeight, min))
f.addHaving(fmt.Sprintf("%s < %d", widthHeight, mn))
case models.CriterionModifierGreaterThan:
f.addHaving(fmt.Sprintf("%s > %d", widthHeight, max))
f.addHaving(fmt.Sprintf("%s > %d", widthHeight, mx))
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/utils/vtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ func GetVTTTime(fracSeconds float64) string {
return "00:00:00.000"
}

var msec, sec, min, hour int
var msec, sec, mnt, hour int
msec = int(fracSeconds * 1000)
sec, msec = norm(sec, msec, 1000)
min, sec = norm(min, sec, 60)
hour, min = norm(hour, min, 60)
mnt, sec = norm(mnt, sec, 60)
hour, mnt = norm(hour, mnt, 60)

return fmt.Sprintf("%02d:%02d:%02d.%03d", hour, min, sec, msec)
return fmt.Sprintf("%02d:%02d:%02d.%03d", hour, mnt, sec, msec)

}

0 comments on commit f1ca048

Please sign in to comment.