diff --git a/sevenkeys/logic/locate.go b/sevenkeys/logic/locate.go index bf9fc31..c71880e 100644 --- a/sevenkeys/logic/locate.go +++ b/sevenkeys/logic/locate.go @@ -34,10 +34,21 @@ func LocateCards(db *sql.DB, cardNames []string, criteria SearchCriteria) ([]str if err != nil { return locations, err } - // TODO: Filter by search criteria var location string for _, result := range results { + printing := database.CardPrinting{ + SetCode: result.SetCode, + IsFoil: result.IsFoil, + IsPromo: result.IsPromo, + Language: result.Language, + } + + filter := filterPrinting(printing, criteria) + if filter { + continue + } + location = fmt.Sprintf("%s (%s %s) [%s]", result.CardName, result.SetCode, diff --git a/sevenkeys/logic/locate_test.go b/sevenkeys/logic/locate_test.go index cd27632..baf4ef5 100644 --- a/sevenkeys/logic/locate_test.go +++ b/sevenkeys/logic/locate_test.go @@ -4,7 +4,7 @@ import "testing" func Test_GetBinderLocationDescription_ReturnsCorrectFormat_ForFrontSlots(t *testing.T) { var position int = 24 - var expected string = "on page 2 in front slot 6" + var expected string = " on page 2 in front slot 6" description := GetBinderLocationDescription(position) @@ -15,7 +15,7 @@ func Test_GetBinderLocationDescription_ReturnsCorrectFormat_ForFrontSlots(t *tes func Test_GetBinderLocationDescription_ReturnsCorrectFormat_ForBackSlots(t *testing.T) { var position int = 17 - var expected string = "on page 1 in back slot 8" + var expected string = " on page 1 in back slot 8" description := GetBinderLocationDescription(position)