-
Notifications
You must be signed in to change notification settings - Fork 38
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
Merge datetime fixes #617
Open
gsrohde
wants to merge
61
commits into
develop
Choose a base branch
from
merge_datetime_fixes
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Merge datetime fixes #617
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Changed name apply_offset -> process_datetime_input. During validation: Don't flag timezone offset '+00:00:00'. Allow season names in month field. Fixed pretty_time to use date attribute instead of obsolete time attribute. In process_datetime_input, set the correct @d_month value and dateloc value when @d_month is a season name.
…c and/or timeloc are nil (such as when the Trait is new).
…tance variable @timezone_offset instead of virtual attribute accessor timezone_offset.
…ier. Always display hours as two digits (this connotes 24-hour clock). Added blank to site selections so traits that don't yet have an associated site don't automatically get some arbitrary default when they are edited.
Removed time zone offset input element. Added blank to site selection dropdown and made it the default so that a new trait doesn't inadvertently get assigned to some arbitrary site.
Added Seasons constant. Made d_* and t_* accessors return site-timezone-adjusted date/time values. Made pretty_date and pretty_time methods show site-timezone-adjusted date and time values. Fixed t_minute accessor (it didn't return @t_minute when it should). Added compute_dateloc convenience method. Made consistent_date_and_time_fields validation method check that input comprises a valid timestamp value. For incomplete input, made sure that standard default values together with input comprise a valid timestamp value. Added validation to ensure a site is selected. Added site_timezone method. Added utctime_from_sitetime method, and use it for generating UTC-based timestamp values for storage in the database from local-site-time-based date and time input values.
Use Trait::Seasons constant in views.
…imezone informatin display. Updated fixtures and tests to go with trait date/time-related changes.
Reformatting. Replaced Rails.logger with just logger.
…now simply relies on computations in methods process_datetime_input, computed_dateloc, and computed_timeloc.
…ay selection and display.
…el and make use of them in the traits views. Typo fix in Trait model: to_id --> to_i Added JavaScript-enabled timezone display to New Trait view.
…errors hash rather than raising a separate exception; that way we see all validation errors, not just the first one we happen to hit.
…nce with new date storage conventions. Dried up a lot of code: Moved Date-Time constants to Module defined in initializer. Use hash to convert Season to representative month number and vice-versa. Use hash to convert TimeOfDay to representative hour number and vice-versa. Added validation of hour. Tweaked validation of minutes. Reformated code.
…sses into a shared module in an intializer.
… computed_dateloc = 8 and julianyear is blank.
…ince the call to save will be done later (so update_attributes is redundant).
…alues. Be more lenient about representative month for seasons--don't raise an exception, just display a warning.
…dates by means of a PL/pgSQL function. Added tests to ensure Rails trait date-related functions are consistent with this interpretation.
…f the time portion of trait dates to migration. Added tests to ensure Rails trait time-related functions are consistent with this interpretation and modified trait and site fixtures to facilitate these tests. Modified format used for "hour-only" time display.
Conflicts: spec/models/trait_spec.rb
…h, day, hour, and minute instead of using instance variables so that unspecified values default to those gleaned from the 'date' column instead of to nil. Only call process_datetime_input before saving if there IS some datetime input.
…the trait model use accessors instead of instance variables to get the year, month, day, hour, and minute.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[in progress]