diff --git a/app/models/instrument.rb b/app/models/instrument.rb index acee1f97..802b5d40 100644 --- a/app/models/instrument.rb +++ b/app/models/instrument.rb @@ -66,6 +66,10 @@ def downsample_rate (starttime, endtime, var_id) .where(time: starttime..endtime) end + if count.to_a.nil? + return self.sample_rate_seconds + end + num_points = count.to_a[0]["count"].to_i if num_points > max_points