37 lines
814 B
Go
37 lines
814 B
Go
package logic
|
|
|
|
import (
|
|
"sevenkeys/database"
|
|
"strings"
|
|
)
|
|
|
|
func filterPrinting(printing database.CardPrinting, searchCriteria SearchCriteria) bool {
|
|
if searchCriteria.SetCode != "" && !strings.Contains(printing.SetCode, searchCriteria.SetCode) {
|
|
return true
|
|
}
|
|
|
|
if searchCriteria.CollectorNumber != "" && !strings.Contains(printing.CollectorNumber, searchCriteria.CollectorNumber) {
|
|
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
|
|
}
|