Pennebaker / craftcms-thearchitect

CraftCMS plugin to generate content models from JSON data.
MIT License
171 stars 9 forks source link

Numbers in a dropdown field should be treated as strings #45

Closed ldstevens closed 7 years ago

ldstevens commented 7 years ago

I have a rating field where authors choose a rating number from a dropdown. TA currently exports those number values as integers (which get rounded, so I get 4 and not 4.0), but I think should treat them as strings (as Craft does).

E.g. Here's what TA exports:


            "group": "Shared",
            "name": "Rating: Overall",
            "handle": "ratingOverall",
            "instructions": "",
            "required": false,
            "type": "Dropdown",
            "typesettings": {
                "options": [
                    {
                        "label": 0,
                        "value": 0,
                        "default": ""
                    },
                    {
                        "label": 0.5,
                        "value": 0.5,
                        "default": ""
                    },
                    {
                        "label": 1,
                        "value": 1,
                        "default": ""
                    },
                    {
                        "label": 1.5,
                        "value": 1.5,
                        "default": ""
                    },
                    {
                        "label": 2,
                        "value": 2,
                        "default": ""
                    },
                    {
                        "label": 2.5,
                        "value": 2.5,
                        "default": ""
                    },
                    {
                        "label": 3,
                        "value": 3,
                        "default": ""
                    },
                    {
                        "label": 3.5,
                        "value": 3.5,
                        "default": ""
                    },
                    {
                        "label": 4,
                        "value": 4,
                        "default": ""
                    },
                    {
                        "label": 4.5,
                        "value": 4.5,
                        "default": ""
                    },
                    {
                        "label": 5,
                        "value": 5,
                        "default": ""
                    }
                ]
            }

And here's what it should be (IMO):

            "group": "Shared",
            "name": "Rating: Overall",
            "handle": "ratingOverall",
            "instructions": "",
            "required": false,
            "type": "Dropdown",
            "typesettings": {
                "options": [
                    {
                        "label": "0.0",
                        "value": "0.0",
                        "default": ""
                    },
                    {
                        "label": "0.5",
                        "value": "0.5",
                        "default": ""
                    },
                    {
                        "label": "1.0",
                        "value": "1.0",
                        "default": ""
                    },
                    {
                        "label": "1.5",
                        "value": "1.5",
                        "default": ""
                    },
                    {
                        "label": "2.0",
                        "value": "2.0",
                        "default": ""
                    },
                    {
                        "label": "2.5",
                        "value": "2.5",
                        "default": ""
                    },
                    {
                        "label": "3.0",
                        "value": "3.0",
                        "default": ""
                    },
                    {
                        "label": "3.5",
                        "value": "3.5",
                        "default": ""
                    },
                    {
                        "label": "4.0",
                        "value": "4.0",
                        "default": ""
                    },
                    {
                        "label": "4.5",
                        "value": "4.5",
                        "default": ""
                    },
                    {
                        "label": "5.0",
                        "value": "5.0",
                        "default": ""
                    }
                ]
            }
Emkaytoo commented 7 years ago

Thanks for posting. We had an issue similar to this last week and it's on our list to fix. Just forgot to post it here. We're on it!

ldstevens commented 7 years ago

Great :) I've got a wild one coming up for you next!