diff options
| author | Zakaria BOUZIANE | 2014-11-24 09:53:51 +0100 | 
|---|---|---|
| committer | Zakaria BOUZIANE | 2014-11-24 09:53:51 +0100 | 
| commit | f7a5c5be620cd2006ec4d17208a9e0ee9bb34dcb (patch) | |
| tree | 537510b2e8db9c8e9a74a282ee17d49ac486b923 /app/controllers/exports_controller.rb | |
| parent | 8b67f87c71e6bdbaa46d11f077583b5c47219c95 (diff) | |
| download | chouette-core-f7a5c5be620cd2006ec4d17208a9e0ee9bb34dcb.tar.bz2 | |
HUB Export only if less than 50000 VehicleJourneyAtStops and start_date and end_date are provided.
Diffstat (limited to 'app/controllers/exports_controller.rb')
| -rw-r--r-- | app/controllers/exports_controller.rb | 13 | 
1 files changed, 10 insertions, 3 deletions
| diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb index cb555a3dd..e8c140dd7 100644 --- a/app/controllers/exports_controller.rb +++ b/app/controllers/exports_controller.rb @@ -14,9 +14,16 @@ class ExportsController < ChouetteController    end    def create -    create! do |success, failure| -      available_exports -      success.html { flash[:notice] = I18n.t('exports.new.flash')+"<br/>"+I18n.t('exports.new.flash2'); redirect_to referential_exports_path(@referential) } +    if (params[:export][:type] == "HubExport") && Chouette::VehicleJourneyAtStop.all.count > 50000 +      flash[:notice] = I18n.t("formtastic.titles.export.vjas.size", size: Chouette::VehicleJourneyAtStop.all.count) +      redirect_to new_referential_export_path(@referential) +    elsif (params[:export][:type] == "HubExport") && (params[:export][:start_date].empty? || params[:export][:end_date].empty?) +      flash[:notice] = I18n.t("formtastic.titles.export.dates.not_nul") +      redirect_to new_referential_export_path(@referential) +    else +      create! do |success, failure| +        success.html { flash[:notice] = I18n.t('exports.new.flash')+"<br/>"+I18n.t('exports.new.flash2'); redirect_to referential_exports_path(@referential) } +      end      end    end | 
