2024-09-12 12:32:01 +00:00
|
|
|
package logic
|
|
|
|
|
2024-10-28 19:47:23 +00:00
|
|
|
import (
|
|
|
|
"sevenkeys/database"
|
|
|
|
"strings"
|
|
|
|
)
|
2024-09-12 12:32:01 +00:00
|
|
|
|
|
|
|
func filterPrinting(printing database.CardPrinting, searchCriteria SearchCriteria) bool {
|
2024-10-28 19:47:23 +00:00
|
|
|
if searchCriteria.SetCode != "" && !strings.Contains(printing.SetCode, searchCriteria.SetCode) {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
if searchCriteria.CollectorNumber != "" && !strings.Contains(printing.CollectorNumber, searchCriteria.CollectorNumber) {
|
2024-09-12 12:32:01 +00:00
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
if searchCriteria.Foil == False && printing.IsFoil {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
if searchCriteria.Foil == True && !printing.IsFoil {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
if searchCriteria.Promo == False && printing.IsPromo {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
if searchCriteria.Promo == True && !printing.IsPromo {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
if searchCriteria.Language != "" && printing.Language != searchCriteria.Language {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
}
|