only compare dates if they exist

This commit is contained in:
Lee Lawlor 2014-07-16 16:12:32 -04:00
parent 6ab9ec1df6
commit ff8077d37b

View File

@ -473,8 +473,8 @@ class ChannelsController < ApplicationController
date1 = Chronic.parse(csv_array[0][0]) if parse_date date1 = Chronic.parse(csv_array[0][0]) if parse_date
date2 = Chronic.parse(csv_array[1][0]) if parse_date date2 = Chronic.parse(csv_array[1][0]) if parse_date
# reverse the array if 1st date is larger than 2nd date # reverse the array if the dates exist and 1st date is larger than 2nd date
csv_array = csv_array.reverse if date1 > date2 csv_array = csv_array.reverse if date1.present? && date2.present? && date1 > date2
end end
# loop through each row # loop through each row