nicho92 / MtgDesktopCompanion

Cards manager for magic the gathering
Apache License 2.0
165 stars 35 forks source link

DelverLens import doesn't recognize Foil column #244

Closed tylergibson closed 1 year ago

tylergibson commented 1 year ago

Import to stock always results in all cards being Foil.

I believe https://github.com/nicho92/MtgDesktopCompanion/blob/2db149815952ee06c2d0bb58b8b9b588a91cbb79/src/main/java/org/magic/api/exports/impl/DelverLensExport.java#L82

st.setFoil(m.group(9)!=null);

should instead be

st.setFoil(m.group(9).equals("Foil"));

Sample provided using DelverLens MTG Companion export:

Name; Edition; Price; Language; Collector's number; Condition; Currency; Edition code; Foil; List name; Quantity; Scryfall ID Karn, Living Legacy; Dominaria United; $4.00; English; 1; Near Mint; USD; DMU; Foil; Dominaria United; 4; e83b1b87-01d5-4624-8a2b-4b771e13e59c Anointed Peacekeeper; Dominaria United; $0.20; English; 2; Near Mint; USD; DMU; ; Dominaria United; 1; 5b8127b5-3a65-411a-84bc-54e5c1be1477 Anointed Peacekeeper; Dominaria United; $0.33; English; 2; Near Mint; USD; DMU; Foil; Dominaria United; 6; 5b8127b5-3a65-411a-84bc-54e5c1be1477 Archangel of Wrath; Dominaria United; $0.05; English; 3; Near Mint; USD; DMU; ; Dominaria United; 2; 2d00bab2-e95d-4296-a805-2a05e7640efb Archangel of Wrath; Dominaria United; $0.19; English; 3; Near Mint; USD; DMU; Foil; Dominaria United; 6; 2d00bab2-e95d-4296-a805-2a05e7640efb Argivian Cavalier; Dominaria United; $0.01; English; 4; Near Mint; USD; DMU; Foil; Dominaria United; 9; 57746e72-ba9f-4717-a4a2-6c6a039080c3 Argivian Phalanx; Dominaria United; $0.01; English; 5; Near Mint; USD; DMU; Foil; Dominaria United; 10; afbadc37-1b4f-4237-a3c0-772bafb18aa0 Artillery Blast; Dominaria United; $0.01; English; 6; Near Mint; USD; DMU; Foil; Dominaria United; 7; 0d4d7293-657f-48ac-931b-fb6a44128e6d Benalish Faithbonder; Dominaria United; $0.01; English; 7; Near Mint; USD; DMU; ; Dominaria United; 1; 084d77df-a899-406f-9d79-e3fa3abeaebc Benalish Faithbonder; Dominaria United; $0.01; English; 7; Near Mint; USD; DMU; Foil; Dominaria United; 10; 084d77df-a899-406f-9d79-e3fa3abeaebc Benalish Sleeper; Dominaria United; $0.01; English; 8; Near Mint; USD; DMU; ; Dominaria United; 1; f96089ea-20cf-496d-84a6-9b660c2ef672 Benalish Sleeper; Dominaria United; $0.05; English; 8; Near Mint; USD; DMU; Foil; Dominaria United; 11; f96089ea-20cf-496d-84a6-9b660c2ef672 Captain's Call; Dominaria United; $0.01; English; 9; Near Mint; USD; DMU; Foil; Dominaria United; 7; 0c7ed7e0-0e80-44d3-a7af-b4c321239df8 Charismatic Vanguard; Dominaria United; $0.01; English; 10; Near Mint; USD; DMU; Foil; Dominaria United; 8; a51764fe-0d75-4cfa-a699-0d9e7ffb7843

tylergibson commented 1 year ago

Just a note @nicho92 - in st.setFoil(m.group(9)!=null); is that m.group(9) will never return null. (It only gets to this point of execution if there's a regex match).

It will always either return a string, or skip the column completely.

Thanks for the quick implementation!

nicho92 commented 1 year ago

Fixed ;)