MushroomObserver / mushroom-observer

A website for sharing observations of mushrooms.
https://mushroomobserver.org
MIT License
78 stars 25 forks source link

Fix date behavior in the Project edit form #2236

Closed mo-nathan closed 3 months ago

mo-nathan commented 3 months ago

To reproduce:

1) Edit a project 2) Select a date range, click the "Range" radio button, and save. 3) Re-edit the project Expected behavior: New date range is shown. Current behavior: Date is set to today

There were two issues. 1) The function date_select_opts only looked for the when field in the object. 2) The same function always expected to get the object from an explicitly provided object: option. The fix uses the field: option and tried to look up the object from any associated form. If it doesn't find one, then it uses the object: option.

coveralls commented 3 months ago

Coverage Status

coverage: 94.459%. remained the same when pulling 8e3093ad64e943668f74a5ea672f5b685d91634a on njw-project-date-fix into 5145bf8ab4dc44e20ec04c39a414de57b6eee90a on main.