magfest / magstock

Plugin to implement magstock-specific logic
1 stars 3 forks source link

The dropdown list for "How are you camping?" is out of order in prereg user interface #144

Closed RobRuana closed 6 years ago

RobRuana commented 6 years ago

As listed in development.ini

[[camping_type]]
small_tent = "Small Tent (small footprint)"
medium_tent = "Medium Tent (around four people)"
large_tent = "Large Tent (large and in charge)"
car = "Car - I plan to sleep in my car at my site for an additonal fee."
rv = "RV - I plan to sleep in an RV or something similar for an additonal fee."
special_site = "Special - I'm planning something that takes up a lot of space."
cabin = "Cabin - I plan to sleep in a cabin or house provided by the campground."

As displayed in prereg user interface

screen shot 2018-03-02 at 10 21 59 am
RobRuana commented 6 years ago

@EliAndrewC, pinging you because you requested an update about this when I figured it out.

This issue occurs because development-defaults.ini is loaded first, and then development.ini is merged in afterward. The [[camping_type]] as listed in development-defaults.ini looks like this:

[[camping_type]]
small_tent = "Small Tent (6 or fewer)"
large_tent = "Large Tent (more than 6)"
car = "Sleeping in car"
rv = "RV or other larger vehicle (Additional fees may apply; please contact us)"

As you can see, the additional enum values from development.ini are appended to the list, instead of being interleaved in the order listed in development.ini.

The proper solution to this issue would involve modifying the merge() algorithm used by ConfigObj to interleave new scalar values relative to scalar values that already exist in the parent ConfigObj instance. That is no small task.

So instead—as a quick 'n dirty hack—I am going to update development-defaults.ini to look like this:

[[camping_type]]
small_tent = "Small Tent (6 or fewer)"
medium_tent = ""
large_tent = "Large Tent (more than 6)"
car = "Sleeping in car"
rv = "RV or other larger vehicle (Additional fees may apply; please contact us)"
special_site = ""
cabin = ""

That will preserve the order of the enum, while still allowing us to remove meduim_tent, special_site, and cabin from our deployment, if we wish.

EliAndrewC commented 6 years ago

Ahhhh, that makes sense, thanks for the update!

Hachi05 commented 6 years ago

Thx Rob!!

On Fri, Mar 2, 2018 at 11:14 AM, Eli Courtwright notifications@github.com wrote:

Ahhhh, that makes sense, thanks for the update!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/magfest/magstock/issues/144#issuecomment-369968736, or mute the thread https://github.com/notifications/unsubscribe-auth/AHOeKZTuLmiujLIty_sOaH62sEhM1qFnks5taW_9gaJpZM4SaDVH .