paulschneider / b247-api

0 stars 0 forks source link

Price as string #56

Closed pablocarrillo closed 10 years ago

pablocarrillo commented 10 years ago

Hi Paul,

On the cycle server after refactor I found that the price is coming as string and it is doing fail several of my test. (Thats the only thing, if I allow that field as string everything is fine)

  {
                            "assignment": {
                                "category": {
                                    "id": 19, 
                                    "name": "Comedy"
                                }, 
                                "channel": {
                                    "id": 50, 
                                    "name": "What's On"
                                }, 
                                "subChannel": {
                                    "id": 60, 
                                    "name": "Theatre"
                                }
                            }, 
                            "displayStyle": 1, 
                            "displayType": {
                                "id": 2, 
                                "type": "Listing"
                            }, 
                            "event": {
                                "details": {
                                    "epoch": 1405017000, 
                                    "id": 21, 
                                    "price": "21.40", 
                                    "sefName": "one-night-of-queen", 
                                    "showDate": "2014-07-10", 
                                    "showTime": "19:30:00", 
                                    "title": "One Night of Queen", 
                                    "url": "http://www.atgtickets.com/shows/one-night-of-queen/bristol-hippodrome/"
                                }, 
                                "venue": {
                                    "address1": "St Augustines Parade", 
                                    "address2": "945 Finn Pass", 
                                    "address3": "Bristol", 
                                    "email": "trishhodson@theambassadors.com", 
                                    "facebook": "BristolHippodrome", 
                                    "id": 1, 
                                    "name": "Bristol Hippodrome", 
                                    "phone": "0844 871 7615", 
                                    "postcode": "BS1 4UZ", 
                                    "sefName": "bristol-hippodrome", 
                                    "twitter": "BristolHipp"
                                }
                            }, 
                            "id": 249, 
                            "isAdvert": false, 
                            "media": {
                                "filepath": "http://wildfirecomms-images.co.uk/b247/10-07-14-6w.jpg"
                            }, 
                            "published": "2014-07-10", 
                            "subHeading": "Over the past 9 years One Night Of Queen has rocked sold out audiences all over the World including UK, Germany, Holland, France, New Zealand. ", 
                            "title": "One Night of Queen"
                        }
paulschneider commented 10 years ago

Is there a reason you need this to be a float rather than a string? I don't seem to be able to keep it in a consistent format so far (I'm trying).

For 27.99 as a string

I can get it to

but not a float as 27.99.

Ive just had to put something on Stackoverflow for this one!!

pablocarrillo commented 10 years ago

Hi Paul,

Well for this I reckon the float are quite tricky. I use in my en a special type "decimal" that keep the correct number of decimals. On the other hand if we all agree to keep this always as a string with this format (no commas and the dot for decimals) I think we can work with this. On the other hand, has a price as a number kind of make sense, because it is a number.

Cheers

paulschneider commented 10 years ago

Ive noticed that this is coming out of the DB in a shorted format as well. If 8.00 is viewed as a float its concatenated to 8. If I number format at number I can get it to 8.00 but its cast to a string.

Its easier (for me at least) if I can always provide them as strings. If you need to operate on them then I can keep researching the best way to do this but if you're just displaying them then strings are quicker to provide.

pablocarrillo commented 10 years ago

Ok, let them as a string for now in cycle and I will inform tomorrow Danielle about this and update my test accordingly.

paulschneider commented 10 years ago

Happy with this one?

pablocarrillo commented 10 years ago

Yes, we can close it and move this and #54 to staging as soon as you can, please.