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

Merge datetime fixes #617

Open
wants to merge 61 commits into
base: develop
Choose a base branch
from
Open

Merge datetime fixes #617

wants to merge 61 commits into from

Conversation

gsrohde
Copy link
Contributor

@gsrohde gsrohde commented Dec 17, 2018

[in progress]

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.
…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.
… 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant