cubicle 0.1.30 → 0.1.31

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,8 @@
1
1
  class DefectCubicle
2
2
  extend Cubicle::Aggregation
3
3
 
4
+ source_collection "defects", :account_id=>"a1"
5
+
4
6
  define :preventable, "this.root_cause != 'act_of_god'"
5
7
  define :product_name, "this.product.name"
6
8
  define :current_year, "'{{date_today_iso}}'.substring(0,4)"
@@ -10,6 +10,7 @@ class Defect
10
10
  #key :outcome, String
11
11
  #key :cost, Float
12
12
  #key :root_cause, String
13
+ #key :account_id=>String
13
14
 
14
15
  def self.collection
15
16
  Cubicle.mongo.database["defects"]
@@ -34,8 +35,8 @@ class Defect
34
35
  :ms1=>t1,
35
36
  :ms2=>t2,
36
37
  :ms3=>t3,
37
- :ms4=>t4
38
-
38
+ :ms4=>t4,
39
+ :account_id=>"a1"
39
40
  t1,t2,t3,t4 = time, time.advance(:days=>2),time.advance(:days=>4),time.advance(:days=>28)
40
41
  Defect.create :defect_id=>"2",
41
42
  :manufacture_date=>"2010-01-01",
@@ -49,10 +50,12 @@ class Defect
49
50
  :ms1=>t1,
50
51
  :ms2=>t2,
51
52
  :ms3=>t3,
52
- :ms4=>t4
53
+ :ms4=>t4,
54
+ :account_id=>"a1"
53
55
  end
54
56
 
55
57
  def self.create_test_data
58
+
56
59
  Defect.create :defect_id=>"1",
57
60
  :manufacture_date=>"2010-01-01",
58
61
  :manufacture_time=>"2010-01-01".to_time,
@@ -61,7 +64,8 @@ class Defect
61
64
  :operator=>"Franny",
62
65
  :outcome=>"Repaired",
63
66
  :cost=>6.50,
64
- :root_cause=>:act_of_god
67
+ :root_cause=>:act_of_god,
68
+ :account_id=>"a1"
65
69
 
66
70
  Defect.create :defect_id=>"2",
67
71
  :manufacture_date=>"2010-01-05",
@@ -71,7 +75,8 @@ class Defect
71
75
  :operator=>"Seymour",
72
76
  :outcome=>"Discarded",
73
77
  :cost=>0.02,
74
- :root_cause=>:operator_error
78
+ :root_cause=>:operator_error ,
79
+ :account_id=>"a1"
75
80
 
76
81
  Defect.create :defect_id=>"3",
77
82
  :manufacture_date=>"2010-02-01",
@@ -81,7 +86,8 @@ class Defect
81
86
  :operator=>"Zooey",
82
87
  :outcome=>"Consumed",
83
88
  :cost=>2.94,
84
- :root_cause=>:poor_judgment
89
+ :root_cause=>:poor_judgment,
90
+ :account_id=>"a1"
85
91
 
86
92
  Defect.create :defect_id=>"4",
87
93
  :manufacture_date=>"2009-12-09",
@@ -91,7 +97,8 @@ class Defect
91
97
  :operator=>"Buddy",
92
98
  :outcome=>"Repaired",
93
99
  :cost=>0.43,
94
- :root_cause=>:act_of_god
100
+ :root_cause=>:act_of_god,
101
+ :account_id=>"a1"
95
102
 
96
103
  Defect.create :defect_id=>"5",
97
104
  :manufacture_date=>"2010-01-01",
@@ -101,6 +108,19 @@ class Defect
101
108
  :operator=>"Franny",
102
109
  :outcome=>"Repaired",
103
110
  :cost=>12.19,
104
- :root_cause=>:defective_materials
111
+ :root_cause=>:defective_materials,
112
+ :account_id=>"a1"
113
+
114
+ #Should be filtered out
115
+ Defect.create :defect_id=>"6",
116
+ :manufacture_date=>"2009-12-09",
117
+ :manufacture_time=>"2009-12-09".to_time,
118
+ :product=>{:name=>"Brush Fire Bottle Rockets",:category=>"Fireworks"},
119
+ :plant=>{:name=>"Plant19",:address=>{:region=>"South",:location=>"Burmingham, Al"}},
120
+ :operator=>"Buddy",
121
+ :outcome=>"Repaired",
122
+ :cost=>10000,
123
+ :root_cause=>:act_of_god,
124
+ :account_id=>"a2"
105
125
  end
106
126
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cubicle
3
3
  version: !ruby/object:Gem::Version
4
- hash: 39
4
+ hash: 37
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 30
10
- version: 0.1.30
9
+ - 31
10
+ version: 0.1.31
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nathan Stults
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-07 00:00:00 -07:00
18
+ date: 2010-07-15 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency