quandl_cassinatra 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,14 +62,19 @@ module Searchable
|
|
62
62
|
search_scope :row, ->(value){
|
63
63
|
# ensure integer
|
64
64
|
value = value.to_i
|
65
|
+
# 0 is the current observation
|
66
|
+
if value == 0
|
67
|
+
order(:desc)
|
68
|
+
limit( 1 )
|
65
69
|
# negative value implies ascending order
|
66
|
-
|
70
|
+
elsif value < 0
|
67
71
|
order(:asc)
|
68
72
|
offset( ( value * -1 ) - 1 )
|
69
73
|
limit( 1 )
|
74
|
+
# postive value is an offset of current observation
|
70
75
|
else
|
71
76
|
order(:desc)
|
72
|
-
offset( value )
|
77
|
+
offset( value - 1 )
|
73
78
|
limit(1)
|
74
79
|
end
|
75
80
|
}
|