class Tempo::Controllers::End

Public Class Methods

end_timer(options, args) click to toggle source
# File lib/tempo/controllers/end_controller.rb, line 11
def end_timer(options, args)

  return Views.project_assistance if Model::Project.index.empty?

  if not options[:at]
    time_out = Time.new().round
  else
    time_out = Time.parse options[:at]
  end

  return Views.no_match_error( "valid timeframe", options[:at], false ) if not time_out

  options[:end_time] = time_out
  options[:description] = reassemble_the args

  @time_records.load_last_day options
  record = @time_records.current
  return Views.no_items( "running time records", :error ) if ! record

  record.end_time = time_out
  record.description = options[:description] if options[:description]
  @time_records.save_to_file options

  Views.end_time_record_view record

end