Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Fix #43479 - Error when job is pending
Browse files Browse the repository at this point in the history
  • Loading branch information
brunto committed Apr 20, 2016
1 parent b431158 commit 21fb4f7
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 25 deletions.
1 change: 1 addition & 0 deletions app/controllers/compliance_checks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def compliance_check_service

def resource
@compliance_check ||= compliance_check_service.find(params[:id])
return @compliance_check unless @compliance_check.report
@line_items = @compliance_check.report.line_items
if @line_items.size > 500
@line_items = @line_items.paginate(page: params[:page], per_page: 20)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/exports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def export_service

def resource
@export ||= export_service.find( params[:id] )
return @export unless @export.report
@line_items = @export.report.line_items
if @line_items.size > 500
@line_items = @line_items.paginate(page: params[:page], per_page: 20)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/imports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def import_service

def resource
@import ||= import_service.find( params[:id] )
return @import unless @import.report
@line_items = @import.report.line_items
if @line_items.size > 500
@line_items = @line_items.paginate(page: params[:page], per_page: 20)
Expand Down
22 changes: 14 additions & 8 deletions app/views/compliance_checks/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<div class="test">
<%= title_tag job_status_title(@compliance_check) %>
</div>
<% if @compliance_check.report.failure_code? %>
<div class="alert alert-danger">
<%= t("iev.failure.#{@compliance_check.report.failure_code}") %>
</div>
<% if @compliance_check.report %>
<% if @compliance_check.report.failure_code? %>
<div class="alert alert-danger">
<%= t("iev.failure.#{@compliance_check.report.failure_code}") %>
</div>
<% end %>
<div class="progress_bars">
<%= progress_bar_tag(@compliance_check) %>
</div>
<% end %>
<div class="progress_bars">
<%= progress_bar_tag(@compliance_check) %>
</div>
<div class="compliance_check show">
<div class="links">
<%= link_to font_awesome_classic_tag("fa-external-link") + t("compliance_checks.actions.report"), report_referential_compliance_check_path(@referential, @compliance_check.id) if @compliance_check.compliance_check_validation_report? %>
</div>
<%= render(partial: "shared/ie_report", locals: { job: @compliance_check, type: :validation, line_items: @line_items } ) %>
<% if @compliance_check.report %>
<%= render(partial: "shared/ie_report", locals: { job: @compliance_check, type: :validation, line_items: @line_items } ) %>
<% else %>
<p><%= t('compliance_checks.statuses.pending') %></p>
<% end %>
</div>

<% content_for :sidebar do %>
Expand Down
22 changes: 14 additions & 8 deletions app/views/exports/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,25 @@
<%= export_attributes_tag(@export) %>
</div>
</div>
<% if @export.report.failure_code? %>
<div class="alert alert-danger">
<%= t("iev.failure.#{@export.report.failure_code}") %>
</div>
<% if @export.report %>
<% if @export.report.failure_code? %>
<div class="alert alert-danger">
<%= t("iev.failure.#{@export.report.failure_code}") %>
</div>
<% end %>
<div class="progress_bars">
<%= progress_bar_tag(@export) %>
</div>
<% end %>
<div class="progress_bars">
<%= progress_bar_tag(@export) %>
</div>
<div class="export_show">
<div class="links">
<%= link_to( font_awesome_classic_tag("fa-file-#{@export.filename_extension}-o") + t("exports.show.exported_file"), exported_file_referential_export_path(@referential, @export.id) ) if @export.file_path %>
</div>
<%= render( partial: "shared/ie_report.html", locals: { job: @export, line_items: @line_items } ) %>
<% if @export.report %>
<%= render( partial: "shared/ie_report.html", locals: { job: @export, line_items: @line_items } ) %>
<% else %>
<p><%= t('exports.statuses.pending') %></p>
<% end %>
</div>

<% content_for :sidebar do %>
Expand Down
22 changes: 14 additions & 8 deletions app/views/imports/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,26 @@
<%= import_attributes_tag(@import) %>
</div>
</div>
<% if @import.report.failure_code? %>
<div class="alert alert-danger">
<%= t("iev.failure.#{@import.report.failure_code}") %>
</div>
<% if @import.report %>
<% if @import.report.failure_code? %>
<div class="alert alert-danger">
<%= t("iev.failure.#{@import.report.failure_code}") %>
</div>
<% end %>
<div class="progress_bars">
<%= progress_bar_tag(@import) %>
</div>
<% end %>
<div class="progress_bars">
<%= progress_bar_tag(@import) %>
</div>
<div class="import_show">
<div class="links">
<%= link_to font_awesome_classic_tag("fa-file-#{@import.filename_extension}-o") + t("imports.show.imported_file"), imported_file_referential_import_path(@referential, @import.id) if @import.file_path? %>
<%= link_to font_awesome_classic_tag("fa-external-link") + t("imports.show.compliance_check"), compliance_check_referential_import_path(@referential, @import.id) if @import.compliance_check? %>
</div>
<%= render(partial: 'shared/ie_report', locals: {job: @import, line_items: @line_items}) %>
<% if @import.report %>
<%= render(partial: 'shared/ie_report', locals: {job: @import, line_items: @line_items}) %>
<% else %>
<p><%= t('imports.statuses.pending') %></p>
<% end %>
</div>

<% content_for :sidebar do %>
Expand Down
3 changes: 2 additions & 1 deletion config/locales/exports.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ en:
report: "Report"
exported_file: "Exported file"
statuses:
pending: "Pending ..."
started: "Started"
scheduled: "Processing ..."
terminated: "Completed"
Expand Down Expand Up @@ -44,4 +45,4 @@ en:
netex_export:
zero: "export"
one: "NeTEx export"
other: "exports"
other: "exports"
1 change: 1 addition & 0 deletions config/locales/exports.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fr:
report: "Rapport"
exported_file: "Fichier exporté"
statuses:
pending: "En attente ..."
started: "En file d'attente..."
scheduled: "En cours..."
terminated: "Achevé"
Expand Down
2 changes: 2 additions & 0 deletions config/locales/imports.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ en:
compliance_check: "Validation report"
compliance_check_of: "Validation of import: "
import_of_validation: "Import of the validation"
statuses:
pending: "Pending ..."
compliance_check_task: "Validate Report"
severities:
info: "Information"
Expand Down
2 changes: 2 additions & 0 deletions config/locales/imports.fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ fr:
compliance_check: "Test de conformité"
compliance_check_of: "Validation de l'import : "
import_of_validation: "L'import de la validation"
statuses:
pending: "En attente ..."
compliance_check_task: "Validation"
severities:
info: "Information"
Expand Down

0 comments on commit 21fb4f7

Please sign in to comment.