GiselleSerate / suitelife

2017 Harvey Mudd Summer Startup Project: iOS App.
https://suite-life.org/
0 stars 0 forks source link

Datatype of price: Handle money like money #4

Closed GiselleSerate closed 7 years ago

GiselleSerate commented 7 years ago

Float is apparently not the most graceful way to handle money. Investigate NSDecimalNumber, but be wary of read/write issues when using NSCoding which according to some people plays nice but other people doesn't.

GiselleSerate commented 7 years ago

Item class now handles money like an int, as of commit ea3b17a452cd3318de6032e76d25c5d634f10aee. Next thing to fix is making the price field limit how many decimal places you are allowed to add.

GiselleSerate commented 7 years ago

Commit c46cdf92822584460cd4c37f34333521e1a24d19 is relevant to this issue. Prints prices as a decimal-shaped decimal in the UI. Next to filter user input. Use a regex? Or figure out what your copy/paste code actually does.

GiselleSerate commented 7 years ago

Also, I think it's confused and might think the price is a name and the name is a price because I'm now allowed to type in the price field. @cole-k did change the field tags to an enum, so it's a possibility that changed things. See either of the following commits. dc68df7b186affdbe3137bfa85cf16bf8f17d266 4ec5bb8a6ca75e6a1d6742cdc8ac028f04743fbe

GiselleSerate commented 7 years ago

Commit dc5bfd0173a799bf2ebb9a31b4864b47c97ade89 fixes this issue, truncating the string on entry.

GiselleSerate commented 7 years ago

Commit 7d8068906950f504e41b84215dcbcea21338cb88 implements this in pantry.

GiselleSerate commented 7 years ago

Marked band-aid fix for now, as it doesn't entirely work with pasting.