[PATCH] BZ 843801 add error if from date is after to date

Matt Wagner matt.wagner at redhat.com
Wed Aug 15 16:28:37 UTC 2012


On Tue, Aug 14, 2012 at 11:29:17AM -0400, Tzu-Mainn Chen wrote:
> ---
>  src/app/controllers/logs_controller.rb      |    7 +++++++
>  src/app/controllers/providers_controller.rb |    4 ++++
>  src/config/locales/en.yml                   |    3 +++
>  3 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/src/app/controllers/logs_controller.rb b/src/app/controllers/logs_controller.rb
> index e55e484..ef2ea7f 100644
> --- a/src/app/controllers/logs_controller.rb
> +++ b/src/app/controllers/logs_controller.rb
> @@ -104,6 +104,13 @@ class LogsController < ApplicationController
>                   params[:to_date][:month].to_i,
>                   params[:to_date][:day].to_i)
>  
> +    if @to_date < @from_date
> +      @events = []
> +      @paginated_events = []
> +      flash[:error] = t('logs.flash.error.date_range')
> +      return
> +    end
> +
>      # modify parameters for pretty view
>      if @view == "pretty"
>        @state = ""
> diff --git a/src/app/controllers/providers_controller.rb b/src/app/controllers/providers_controller.rb
> index e8e6f8b..f3a9302 100644
> --- a/src/app/controllers/providers_controller.rb
> +++ b/src/app/controllers/providers_controller.rb
> @@ -30,6 +30,10 @@ class ProvidersController < ApplicationController
>                   params[:to_date][:month].to_i,
>                   params[:to_date][:day].to_i)
>  
> +    if @to_date < @from_date
> +      flash[:error] = t('logs.flash.error.date_range')
> +    end
> +
>      load_headers
>      statistics
>  
> diff --git a/src/config/locales/en.yml b/src/config/locales/en.yml
> index 151a84e..9bddbc3 100644
> --- a/src/config/locales/en.yml
> +++ b/src/config/locales/en.yml
> @@ -46,6 +46,9 @@ en:
>        image: Image
>        hwp: Hardware Profile
>        export_logs: Export logs
> +    flash:
> +      error:
> +        date_range: "'From date' cannot be after 'To date'"
>    users:
>      users: "Users"
>      return_to: "Return to:"
> -- 
> 1.7.6.5

ACK. Pushed to master and 1.1.

-- Matt



More information about the aeolus-devel mailing list