intermine 0.99.00 → 0.99.01

Sign up to get free protection for your applications and to get access to all the features.
@@ -723,8 +723,11 @@ module InterMine::PathQuery
723
723
  #
724
724
  def add_sort_order(path, direction="ASC")
725
725
  p = self.path(path)
726
- if !@views.include? p
727
- raise ArgumentError, "Sort order (#{p}) not in view (#{@views.map {|v| v.to_s}.inspect} in #{self.name || 'unnamed query'})"
726
+ selected = @views.map {|v| v.prefix}
727
+ selected.push(@constraints.map {|c| c.path.is_attribute? ? c.path.prefix : c.path })
728
+ selected.uniq!
729
+ if !selected.include? p.prefix
730
+ raise ArgumentError, "Sort order (#{p}) not on a selected class (#{selected.map {|v| v.to_s}.inspect} in #{self.name || 'unnamed query'})"
728
731
  end
729
732
  @sort_order << SortOrder.new(p, direction)
730
733
  return self
@@ -14,5 +14,6 @@ module Intermine
14
14
  # 0.98.08 - Added column summary support
15
15
  # 0.99.00 - Added coercion from query to lists in "IN/NOT IN" constraints
16
16
  # - Added support for "json" format (performance) improvement
17
- VERSION = "0.99.00"
17
+ # 0.99.01 - Added support for sort-orders on selected classes which are not in the view
18
+ VERSION = "0.99.01"
18
19
  end
data/test/test_query.rb CHANGED
@@ -848,6 +848,12 @@ class TestQuery < Test::Unit::TestCase
848
848
 
849
849
  assert_equal(query.sort_order.last.path, "Employee.name")
850
850
  assert_equal(query.sort_order.last.direction, "DESC")
851
+
852
+ query.add_sort_order("fullTime")
853
+
854
+ assert_equal(query.sort_order.last.path, "Employee.fullTime")
855
+ assert_equal(query.sort_order.last.direction, "ASC")
856
+
851
857
  end
852
858
 
853
859
  def test_subclassed_sort_order
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: intermine
3
3
  version: !ruby/object:Gem::Version
4
- hash: 403
4
+ hash: 401
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 99
9
- - 0
10
- version: 0.99.00
9
+ - 1
10
+ version: 0.99.01
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Kalderimis