taw / magic-search-engine

Search engine for Magic cards
MIT License
47 stars 19 forks source link

`count` booster key does not work with `use` or `any` #335

Closed axxroytovu closed 1 week ago

axxroytovu commented 1 week ago

Input:

sheets:
  test:
    filter: "e:dsk"
    use: rare_mythic
    count: 10
  test2:
    any:
    - rawquery: "e:dsk r:m"
      rate: 1
    - rawquery: "e:dsk r:r"
      rate: 2
    count: 10

Expected behavior: Expected {something?} to return 10 got 70 Expected {something?} to return 10 got 70

Current behavior: No error

taw commented 1 week ago

Oh fun. So count was working on query level, not sheet level.

I think use already worked before, if you used any+query. use+any didn't work because it was passed to any, and any didn't do anything with it.

I added count on sheet level, and there are some real fun results now:

Expected query is:front is:foil (e:acr r:m (-is:foilonly -number:/z/) (frame:showcase or is:borderless)) to return 13, got 14
Expected query is:front is:foil (e:acr r:r frame:extendedart) to return 16, got 17
clb/extended_commander: Expected sheet to have 26 cards, got 27
clb/etched_rare_mythic: Expected sheet to have 32 cards, got 36
clb/foil_showcase_rare_mythic: Expected sheet to have 44 cards, got 113
clb/foil_rare_mythic: Expected sheet to have 22 cards, got 99
clb/background: Expected sheet to have 26 cards, got 25
cmr/etched_foil: Expected sheet to have 101 cards, got 100
dmu/foil_alt_border_rare_mythic: Expected sheet to have 76 cards, got 80
dmu/showcase_rare_mythic: Expected sheet to have 46 cards, got 50
dmu/legendary_uncommon: Expected sheet to have 20 cards, got 40
dsk/test1: Expected sheet to have 20 cards, got 169
dsk/test2: Expected sheet to have 10 cards, got 169
mh2/etched_common_uncommon: Expected sheet to have 42 cards, got 43
mh2/etched_rare_mythic: Expected sheet to have 58 cards, got 60
mom/sfc_rare_mythic: Expected sheet to have 54 cards, got 118
mom/dfc_rare_mythic: Expected sheet to have 10 cards, got 20
mom/showcase_wild: Expected sheet to have 80 cards, got 64
mom/foil_showcase: Expected sheet to have 139 cards, got 85
unf/foil_rare_mythic: Expected sheet to have 135 cards, got 59

I added this file to test data/boosters/dsk-test.yaml, but it looks like we have a lot of existing warnings triggering everywhere:

  test1: 1
  test2: 1
sheets:
  test1:
    filter: "e:dsk"
    use: rare_mythic
    count: 20
  test2:
    any:
    - rawquery: "e:dsk r:m"
      rate: 1
    - rawquery: "e:dsk r:r"
      rate: 2
    count: 10
axxroytovu commented 1 week ago

Is this merged? Id also like to use this on the RVR collector booster updates I'm making to fix #333

taw commented 1 week ago

Yes, it's merged. Should I keep this issue open until the list of mismatches above gets cleaned up, or would it take long and be better as a separate issue?

axxroytovu commented 1 week ago

If I don't get around to fixing these over the weekend I'll make a separate issue. You can leave it open until then just so I have the tracking.

taw commented 1 week ago

OK, so that all got cleaned up, nice job.

axxroytovu commented 1 week ago

Yeah it was a good exercise. Some places I had my counts wrong and some places had an extra card that shouldn't have been there.