Smart Group with Buy It Now Price trigger not working for some amounts

My Smart Group DOES WORK for all amounts EXCEPT those between $64.99 and $99.99.

Even if I delete the triggers and re-add them the listings still show up.

Strange…
Neal


eg)


And if I Stop a listing, change the BIN price (from say $29.99 to $26.99), and Relist the listing shows up in the Smart Group. Actually, all I need to do is change the BIN price on a Running listing from $29.99 to $26.99 and it shows up in the Smart Group. And changing the price back to $29.99 from $26.99 does NOT remove the listing from the Smart Group.

Neal

Any chance you could send me your current GarageSale.leveldb via Dropbox, so I could try to figure out what the problem is?

And NEW Listings that were Started yesterday and now showing up today when I open the app… With prices list $23.99, $29.99 and $44.99.

If I open the Smart Group window and click OK, these new listings go away and I get the same 99 results as yesterday. (still has listings between $64.99 and $99.99)

Also, if you change the “is not $69.99” trigger to “is 69.99” those listings DO NOT show up…

Neal

And when I relist an item it shows up in the Smart Group, no matter what the price is. Even with prices like $19.99, $21.99, $23.99.

If I open the Smart Group editor window and click the OK button, these newly re-listed listings go away.

But all the $64.99 thru $99.99 listings still remain…

Neal

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.

The problem lies with how the predicates for the smart groups are created and stored. Thinking about a good way to fix this:

(lldb) po [self predicateForSmartGroup:smartGroup]
listingState ==[cd] 1 AND buyItNowPriceAmount >[cd] 0 AND buyItNowPriceAmount !=[cd] 64.98999999999999 AND buyItNowPriceAmount !=[cd] 69.98999999999999 AND buyItNowPriceAmount !=[cd] 74.98999999999999

This is how an amount of entered as 64.99 gets stored in the database. No wonder you are getting no matches.

(lldb)po (float)[inObject buyItNowPriceAmount]
64.9000015
1 Like

Oooh yeah the old “currency should never, ever be stored as a float” rule is definitely violated here.

We used strings to story currency amounts in earlier versions of GS, but these gave us a lot of problems when it came to localization/formatting support from the OS. Floating point values are easier to deal with on MacOS in this regard.

Is there a general purpose currency-handling library for the language you’re using now?

We are using Apple’s NSNumberFormatter, which works great for most uses cases. It converts floating point values to and from whatever currency or formatting settings are active.

1 Like

This topic was automatically closed after 8 days. New replies are no longer allowed.