Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Existing plant lines upload #781

Merged
merged 5 commits into from
Feb 28, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ window.PlantPopulationSubmission = class PlantPopulationSubmission extends Submi
$li = $("<li></li>").text(error)
$errors.find("ul").append($li)
)
else
@$('.fileinput-button').removeClass('disabled')

$errors = $(".errors").text("").removeClass('hidden').append("<ul></ul>")
$errors.find("ul").append($("<li></li>").text("Unexpected server response: #{data.jqXHR.status} #{data.jqXHR.statusText}"))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works - I was able to see a 500 error when I uploaded a wrong file. What is wrong, however, that I got that 500 in the first place. I tried to upload a completely wrong file and I caught BIP trying to select on nil:

NoMethodError - private method `select' called for nil:NilClass:
  app/decorators/submission_plant_lines_upload_decorator.rb:22:in `uploaded_new_plant_lines'
  app/decorators/submission_plant_lines_upload_decorator.rb:4:in `as_json'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you remember what kind of file you uploaded? I only managed to get this 500 response using a badly encoded file, otherwise I get regular error message such as "File content type is invalid".

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did it with two files, one was even a CSV, only a completely different one (than expected). I also remember I selected nothing on the 2nd step. The 3rd step was also empty when I uploaded the file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, fixed.


@$('.delete-plant-lines-upload').on 'ajax:success', (data, status, xhr) =>
@$('.fileinput').removeClass('hidden')
Expand Down
10 changes: 10 additions & 0 deletions app/assets/javascripts/components/plant_trial_submission.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ window.PlantTrialSubmission = class PlantTrialSubmission extends Submission
$li = $("<li></li>").text(error)
$errors.find("ul").append($li)
)
else
@$('.fileinput-button').removeClass('disabled')

$errors = $(".errors").text("").removeClass('hidden').append("<ul></ul>")
$errors.find("ul").append($("<li></li>").text("Unexpected server response: #{data.jqXHR.status} #{data.jqXHR.statusText}"))

@$('.delete-trait-scores-upload').on 'ajax:success', (data, status, xhr) =>
@$('.fileinput').removeClass('hidden')
Expand Down Expand Up @@ -128,6 +133,11 @@ window.PlantTrialSubmission = class PlantTrialSubmission extends Submission
$li = $("<li></li>").text(error)
$errors.find("ul").append($li)
)
else
@$('.fileinput-button').removeClass('disabled')

$errors = $(".errors").text("").removeClass('hidden').append("<ul></ul>")
$errors.find("ul").append($("<li></li>").text("Unexpected server response: #{data.jqXHR.status} #{data.jqXHR.statusText}"))

@$('.delete-layout-upload').on 'ajax:success', (data, status, xhr) =>
@$('.fileinput').removeClass('hidden')
Expand Down