Class: Menu::TimeMenu::CustomtimeMenu
- Defined in:
- lib/menu/worktime/customtime_menu.rb
Overview
class to present the available query options for a given month and for a given entity, identified by its id
Instance Attribute Summary
Attributes inherited from TimeMenu
#additions, #time_string, #values
Attributes inherited from Base
#menu_description, #menu_items
Instance Method Summary collapse
-
#get_input_values ⇒ Object
private
method to retrieve the required input values.
-
#initialize ⇒ CustomtimeMenu
constructor
initialization.
-
#retrieve_tasks ⇒ Hash
private
method to retrieve all task that started, ended or took place within the custom time interval for the provided id.
-
#retrieve_worktime ⇒ Object
private
method to retrieve the overall worktime for an entity with the given id for the custom time interval.
-
#set_boundaries ⇒ Object
private
method to calculate the date boundaries of the provided user input.
Methods inherited from TimeMenu
#calculate_worktime, #check_attributes, #check_time_string, #define_menu_items, #determine_action, #output_to_csv, #print_all_tasks, #print_tasks_in_interval, #print_tasks_to_key, #retrieve_and_print_worktime
Methods inherited from Base
#add_menu_item, #define_menu_items, #determine_action, #get_entry, #handle_wrong_option, #print_menu
Constructor Details
#initialize ⇒ CustomtimeMenu
initialization
12 13 14 |
# File 'lib/menu/worktime/customtime_menu.rb', line 12 def initialize super("custom interval") end |
Instance Method Details
#get_input_values ⇒ Object (private)
method to retrieve the required input values
19 20 21 22 23 24 25 26 |
# File 'lib/menu/worktime/customtime_menu.rb', line 19 def get_input_values @values = Hash.new() @values[:id] = get_entry("Worktime for which ID? ").to_i @values[:start_time] = Menu.parse_date( get_entry("Enter start date (format: YYYY-MM-DD-hh:mm): ")) @values[:end_time] = Menu.parse_date( get_entry("Enter end date (format: YYYY-MM-DD-hh:mm): ")) end |
#retrieve_tasks ⇒ Hash (private)
method to retrieve all task that started, ended or took place within the custom time interval for the provided id
38 39 40 |
# File 'lib/menu/worktime/customtime_menu.rb', line 38 def retrieve_tasks Query.get_data(@values[:id], @values[:start_time], @values[:end_time]) end |
#retrieve_worktime ⇒ Object (private)
method to retrieve the overall worktime for an entity with the given id for the custom time interval
44 45 46 47 |
# File 'lib/menu/worktime/customtime_menu.rb', line 44 def retrieve_worktime Query.get_time_worktime(@values[:id], @values[:start_time], @values[:end_time]) end |
#set_boundaries ⇒ Object (private)
method to calculate the date boundaries of the provided user input
29 30 31 32 |
# File 'lib/menu/worktime/customtime_menu.rb', line 29 def set_boundaries return "Calculated interval for week from input:" \ " #{@values[:start_time]} - #{@values[:end_time]}" end |