Data-Liberation-Front / csvlint.io

Check that your CSV files are valid
http://csvlint.io
MIT License
73 stars 12 forks source link

CSVlint Statistics returns 500 #366

Open quadrophobiac opened 7 years ago

quadrophobiac commented 7 years ago

Current Behaviour (for problems)

navigating to http://csvlint.io/statistics.json returns a 500 error, when it should serve JSON of total number of CSVlint validations

quadrophobiac commented 7 years ago

Logs return the following

Started GET "/statistics.json" for 141.101.98.229 at 2017-09-06 12:10:30 +0000
Processing by SummaryController#index as JSON
  Rendered summary/index.json.jbuilder (7.3ms)
Completed 500 Internal Server Error in 11ms

ActionView::Template::Error (undefined method `each' for nil:NilClass):
     5:   json.to Validation.last.created_at
     6: end
     7: json.results do
     8:   @summary.states.each do |state, count|
     9:     json.set! state, count
    10:   end
    11: end
  app/views/summary/index.json.jbuilder:8:in `block in _app_views_summary_index_json_jbuilder___1015693147123677908_70273486309400'
  app/views/summary/index.json.jbuilder:7:in `_app_views_summary_index_json_jbuilder___1015693147123677908_70273486309400'
quadrophobiac commented 7 years ago

Problem seems to reside in the @summary instance variable set by SummaryController, or the problem may reside in the Mongo Model for Summary.
Test suite is passing so whatever error is currently occurring is not captured by existing coverage