fix errors if no csv data or incorrect last group call specified

This commit is contained in:
Lee Lawlor
2014-05-26 20:32:09 -04:00
parent fa333400c8
commit 3f19baae37
3 changed files with 7 additions and 3 deletions

View File

@ -104,8 +104,11 @@ class FeedController < ApplicationController
# put feeds in correct order (oldest to most recent)
last_feeds.reverse!
# check if the correct param is present by getting the param name from arg, e.g.: 'median' from 'medians'
correct_params_present = params[arg.chop.to_sym].present?
feeds_into = self.method("feeds_into_#{arg}")
feed = feeds_into.call(last_feeds, params).last if last_feeds.length > 0
feed = feeds_into.call(last_feeds, params).last if last_feeds.length > 0 && correct_params_present
create_group_result(feed)
end