Module: Timet::ItemDataHelper
- Defined in:
- lib/timet/item_data_helper.rb
Overview
Helper methods for fetching item data.
Class Method Summary collapse
-
.fetch_item_after_start(db, id) ⇒ Integer
Fetches the start time of the tracking item after the current one.
-
.fetch_item_before_end(db, id, item_start) ⇒ Integer
Fetches the end time of the tracking item before the current one.
-
.fetch_item_end(item) ⇒ Integer
Fetches the end time of a tracking item.
-
.fetch_item_start(item) ⇒ Integer
Fetches the start time of a tracking item.
Class Method Details
.fetch_item_after_start(db, id) ⇒ Integer
Fetches the start time of the tracking item after the current one.
55 56 57 |
# File 'lib/timet/item_data_helper.rb', line 55 def fetch_item_after_start(db, id) db.find_item(id + 1)&.dig(Timet::Application::FIELD_INDEX['start']) || TimeHelper. end |
.fetch_item_before_end(db, id, item_start) ⇒ Integer
Fetches the end time of the tracking item before the current one.
42 43 44 |
# File 'lib/timet/item_data_helper.rb', line 42 def fetch_item_before_end(db, id, item_start) db.find_item(id - 1)&.dig(Timet::Application::FIELD_INDEX['end']) || item_start end |
.fetch_item_end(item) ⇒ Integer
Fetches the end time of a tracking item.
28 29 30 |
# File 'lib/timet/item_data_helper.rb', line 28 def fetch_item_end(item) item[Timet::Application::FIELD_INDEX['end']] || TimeHelper. end |
.fetch_item_start(item) ⇒ Integer
Fetches the start time of a tracking item.
16 17 18 |
# File 'lib/timet/item_data_helper.rb', line 16 def fetch_item_start(item) item[Timet::Application::FIELD_INDEX['start']] end |