@@ -16,17 +16,23 @@ def self.setup
1616 # optional list columns out of the column picker on an instance that has not
1717 # enabled the plugin anywhere.
1818 def self . any_tracker_enabled?
19- Array ( settings [ 'tracker_ids' ] ) . reject ( & :blank? ) . any?
19+ enabled_tracker_ids . any?
2020 end
2121
2222 def self . settings
2323 Setting . plugin_redmine_issue_datetime
2424 end
2525
26+ # The tracker ids the plugin is enabled for. The setting is stored as an
27+ # array of strings and contains a blank entry from the form's hidden field.
28+ def self . enabled_tracker_ids
29+ Array ( settings [ 'tracker_ids' ] ) . reject ( &:blank? ) . map ( &:to_i )
30+ end
31+
2632 def self . enabled_for? ( tracker_id )
2733 return false if tracker_id . blank?
2834
29- Array ( settings [ 'tracker_ids' ] ) . reject ( & :blank? ) . map ( & :to_i ) . include? ( tracker_id . to_i )
35+ enabled_tracker_ids . include? ( tracker_id . to_i )
3036 end
3137
3238 def self . time_step_minutes
@@ -46,22 +52,20 @@ def self.reference_zone
4652 ActiveSupport ::TimeZone [ 'UTC' ]
4753 end
4854
49- # Short name of the reference zone, for labelling times in the UI.
50- #
51- # Times are stored as instants and always shown on one clock, the instance's
52- # reference zone, rather than each viewer's own. For site-based work that is
53- # the useful choice: a dispatcher and someone at the site must mean the same
54- # wall-clock time by "09:15". The label is what keeps that unambiguous.
55+ # Zone labels for the UI.
5556 #
56- # Two labels, because the honest label depends on what is being labelled.
57+ # Times are always shown on one clock, the instance's reference zone, never
58+ # converted to each viewer's own zone. For work that happens at a physical
59+ # place, everyone must mean the same wall-clock time by "09:15", and the
60+ # visible zone label is what makes that unambiguous.
5761 #
58- # zone_abbreviation needs an instant and has no default: the abbreviation is
59- # daylight-saving dependent, so "now" would be wrong whenever the thing on
60- # screen is in another part of the year. Use it only where a specific time is
61- # displayed.
62+ # There are two label methods because the correct label depends on context:
6263 #
63- # zone_name is for anywhere that covers many dates or none yet - a list header,
64- # an empty form - where no single abbreviation can be correct.
64+ # - zone_abbreviation(at) is daylight-saving aware, so it requires the
65+ # instant being displayed (deliberately no default: "now" would be wrong
66+ # for a time in another part of the year). Use it next to a specific time.
67+ # - zone_name is season-independent. Use it where many dates are covered,
68+ # or none yet: list headers, empty forms.
6569 def self . zone_abbreviation ( at )
6670 at . in_time_zone ( reference_zone ) . strftime ( '%Z' )
6771 end
0 commit comments