Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong tzinfo_tz value stored in database #270

Closed
atruskie opened this issue Mar 21, 2016 · 3 comments
Closed

Wrong tzinfo_tz value stored in database #270

atruskie opened this issue Mar 21, 2016 · 3 comments

Comments

@atruskie
Copy link
Member

It appears that the wrong value is persisted to the database for the tzinfo_tz value.

Instead of Australia/Sydney being stored, the friendly value Australia - Sydney value is stored.

This causes exceptions when we try and decode the value in the new code from #262 - particularly this line https://github.com/QutBioacoustics/baw-server/blob/6571c40259dff1643778472e7e7d8ea911120935/lib/modules/time_zone_helper.rb#L98

Confirmed problem by manually changing value in database - no longer causes exceptions.

Further:

  • this problem affects the timezones for sites as well as users
  • invalid formats are stored in the production database for both users and sites
  • fixing this will require running a migration or a script
  • this issue is blocking a prod deploy
@cofiem
Copy link
Contributor

cofiem commented Mar 26, 2016

Instead of having to change prod db, I just converted to tzinfo id from tz info friendly id when rendering.

There are also a bunch more tests.

@atruskie
Copy link
Member Author

Question - are the proper values now stored?

@cofiem
Copy link
Contributor

cofiem commented Mar 26, 2016

As far as I can see, it doesn't matter whether we store identifier or friendly identifier. Only issue might be ambiguity in friendly identifiers, but so far I can't see where that would happen. It's easy enough to convert between friendly_identifier and identifier.

The extra tests I added should help catch any problems already stored in db. I also added a validation to the rails forms - the form will force user to change invalid timezone name before the form will successfully submit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants