mochigome 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/TODO CHANGED
@@ -1,6 +1,5 @@
1
1
  - Still need some way to filter queries by weird stuff (i.e. EffectivelyDatedAssociation, or to filter AttendanceRecords by the dates on the Sessions that they belong_to)
2
- - Maybe can do this by adjusting the EffectivelyDated module so that when included it calls a hook on Mochigome that describes the possible filter on the effectively dated object (i.e. SectionRoster) as an SQL snippet referencing "SectionRoster" typed entries of the effective dates table.
3
- - Do as few queries as possible to accomplish stuff; this also encourages app to rely on SQL's 'IN' syntax and magical grouping/joining abilities to make aggregation easier
4
2
  - Replace all the TODOs and FIXMEs with whatever they're asking for (additional checks, use of ordered indifferent hashes instead of arrays of hashes, etc.)
5
3
  - If there is more than one association from model A to model B and they're both focusable, pick the one with no conditions. If all the associations have conditions, complain and require that the correct association be manually specified (where "correct" might mean none of them should be valid)
6
4
  - Alternately, always ignore conditional associations unless they're specifically provided to Mochigome by the model
5
+ - Named subsets of different fields and agg fields on a single model
data/lib/mochigome_ver.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mochigome
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/model_graph.rb CHANGED
@@ -56,19 +56,14 @@ module Mochigome
56
56
  real_tgt = tgt.to_real_model
57
57
  unless real_src == real_tgt
58
58
  seg = @shortest_paths[[real_src,real_tgt]]
59
- unless seg
60
- raise QueryError.new("No path: #{real_src.name} to #{real_tgt.name}")
61
- end
59
+ return nil unless seg
62
60
  path.concat seg.take(seg.size-1).drop(1)
63
61
  end
64
62
  path << tgt
65
63
  end
66
- unless path.uniq.size == path.size
67
- raise QueryError.new(
68
- "Path thru #{models.map(&:name).join('-')} doubles back: " +
69
- path.map(&:name).join('-')
70
- )
71
- end
64
+
65
+ # Don't return any paths that double back
66
+ return nil unless path.uniq.size == path.size
72
67
  path
73
68
  end
74
69
 
data/lib/query.rb CHANGED
@@ -240,7 +240,12 @@ module Mochigome
240
240
  end
241
241
 
242
242
  def join_on_path_thru(path)
243
- join_on_path(@model_graph.path_thru(path).uniq)
243
+ full_path = @model_graph.path_thru(path).uniq
244
+ if full_path
245
+ join_on_path(full_path)
246
+ else
247
+ raise QueryError.new("Cannot route thru #{path.map(&:name).inspect}")
248
+ end
244
249
  end
245
250
 
246
251
  def join_on_path(path)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mochigome
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 3
10
- version: 0.1.3
9
+ - 4
10
+ version: 0.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - David Mike Simon
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-17 00:00:00 Z
18
+ date: 2012-04-19 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement