Files
grecia/app/controllers/concerns/dashboard/expects_date_range.rb
Javi Martín d0d681a44b Add and apply EmptyLineAfterGuardClause rule
We were inconsistent on this one. I consider it particularly useful when
a method starts with a `return` statement.

In other cases, we probably shouldn't have a guard rule in the middle of
a method in any case, but that's a different refactoring.
2019-10-24 17:56:03 +02:00

18 lines
383 B
Ruby

module Dashboard::ExpectsDateRange
extend ActiveSupport::Concern
include Dashboard::HasProposal
def start_date(fallback_date = proposal.created_at.to_date)
return Date.parse(params[:start_date]) unless params[:start_date].blank?
fallback_date
end
def end_date
return Date.parse(params[:end_date]) unless params[:end_date].blank?
Date.current
end
end