erp_work_effort 4.0.0 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v1/projects_controller.rb +25 -0
  3. data/app/controllers/api/v1/time_entries_controller.rb +313 -0
  4. data/app/controllers/api/v1/transportation_routes_controller.rb +9 -0
  5. data/app/controllers/api/v1/work_effort_associations_controller.rb +102 -0
  6. data/app/controllers/api/v1/work_effort_party_assignments_controller.rb +136 -0
  7. data/app/controllers/api/v1/work_effort_types_controller.rb +120 -0
  8. data/app/controllers/api/v1/work_efforts_controller.rb +284 -0
  9. data/app/models/associated_transportation_route.rb +8 -5
  10. data/app/models/cal_evt_party_role.rb +9 -0
  11. data/app/models/calendar_event.rb +46 -0
  12. data/app/models/calendar_invite.rb +10 -0
  13. data/app/models/candidate_submission.rb +37 -0
  14. data/app/models/experience.rb +11 -0
  15. data/app/models/extensions/biz_txn_events.rb +35 -0
  16. data/app/models/extensions/finacial_txns.rb +27 -0
  17. data/app/models/extensions/order_line_item.rb +12 -0
  18. data/app/models/extensions/party.rb +204 -0
  19. data/app/models/party_skill.rb +2 -0
  20. data/app/models/pay_period.rb +59 -0
  21. data/app/models/position.rb +8 -0
  22. data/app/models/position_fulfillment.rb +8 -0
  23. data/app/models/position_type.rb +12 -0
  24. data/app/models/project.rb +59 -0
  25. data/app/models/requirement.rb +2 -0
  26. data/app/models/resume.rb +11 -0
  27. data/app/models/shift.rb +22 -0
  28. data/app/models/skill_type.rb +8 -0
  29. data/app/models/staffing_position.rb +9 -0
  30. data/app/models/time_entry.rb +260 -0
  31. data/app/models/timesheet.rb +194 -0
  32. data/app/models/timesheet_party_role.rb +21 -0
  33. data/app/models/transportation_route.rb +103 -18
  34. data/app/models/transportation_route_segment.rb +44 -0
  35. data/app/models/transportation_route_stop.rb +19 -0
  36. data/app/models/wc_code.rb +7 -0
  37. data/app/models/work_effort.rb +512 -30
  38. data/app/models/work_effort_association.rb +7 -0
  39. data/app/models/work_effort_association_type.rb +5 -0
  40. data/app/models/work_effort_biz_txn_event.rb +22 -0
  41. data/app/models/work_effort_party_assignment.rb +140 -3
  42. data/app/models/work_effort_type.rb +5 -0
  43. data/config/routes.rb +54 -11
  44. data/db/data_migrations/20150709053041_add_skill_types.rb +27 -0
  45. data/db/data_migrations/20150709055922_add_position_types.rb +27 -0
  46. data/db/data_migrations/20150711220000_add_task_tracked_statuses.rb +25 -0
  47. data/db/data_migrations/20150712081804_add_work_effort_types.rb +23 -0
  48. data/db/data_migrations/20150718052204_add_project_tracked_statuses.rb +24 -0
  49. data/db/data_migrations/20150718054404_add_project_party_role_types.rb +14 -0
  50. data/db/data_migrations/20150812150320_add_work_effort_dependency_types.rb +35 -0
  51. data/db/migrate/20100220000000_base_work_efforts.rb +310 -89
  52. data/db/migrate/20150227174108_create_staffing_positions.rb +11 -0
  53. data/db/migrate/20150305194158_create_wc_codes.rb +24 -0
  54. data/db/migrate/20150313134411_create_shifts.rb +28 -0
  55. data/db/migrate/20150325195749_create_candidate_submissions.rb +22 -0
  56. data/db/migrate/20150327115910_resumes.rb +15 -0
  57. data/db/migrate/20150401060938_add_resume_parser_statuses.rb +14 -0
  58. data/db/migrate/20150607181734_create_calendar_events.rb +24 -0
  59. data/db/migrate/20150616174228_create_cal_evt_party_roles.rb +19 -0
  60. data/db/migrate/20150707164520_create_calendar_invites.rb +21 -0
  61. data/db/migrate/20150718052404_create_projects.rb +20 -0
  62. data/db/migrate/20150812191812_update_work_efforts.rb +59 -0
  63. data/db/migrate/20150824152639_add_sequence_to_work_effort.rb +9 -0
  64. data/db/migrate/20150830133951_add_work_effort_biz_txn_events.rb +21 -0
  65. data/db/migrate/20150908200612_update_time_entries.rb +70 -0
  66. data/db/migrate/20151115180427_add_defaults_for_work_effort.rb +36 -0
  67. data/db/migrate/20151218195330_update_transportation_routes.rb +72 -0
  68. data/db/migrate/20160310163052_add_created_by_updated_by_to_erp_work_effort.rb +63 -0
  69. data/db/migrate/20160418115227_add_created_by_updated_by_to_skill_type.rb +34 -0
  70. data/lib/erp_work_effort.rb +3 -0
  71. data/lib/erp_work_effort/config.rb +33 -0
  72. data/lib/erp_work_effort/engine.rb +0 -4
  73. data/lib/erp_work_effort/services/unit_converter.rb +284 -0
  74. data/lib/erp_work_effort/version.rb +1 -1
  75. data/lib/tasks/populate_model_data.rake +19 -0
  76. data/lib/tasks/resume_parser.rake +18 -0
  77. metadata +80 -16
  78. data/app/controllers/erp_work_effort/erp_app/organizer/tasks/base_controller.rb +0 -13
  79. data/app/controllers/erp_work_effort/erp_app/organizer/tasks/work_efforts_controller.rb +0 -128
  80. data/db/data_migrations/20131213151309_create_tasks_organizer_application.rb +0 -14
  81. data/db/migrate/20130829153419_base_routes.rb +0 -93
  82. data/db/migrate/20131213140617_add_work_effort_role_assignments.rb +0 -16
  83. data/db/migrate/20131213144223_add_work_item_to_work_effort.rb +0 -8
  84. data/db/migrate/20140106184615_update_work_effort_item_id_to_int.rb +0 -27
@@ -0,0 +1,63 @@
1
+ class AddCreatedByUpdatedByToErpWorkEffort < ActiveRecord::Migration
2
+ def up
3
+ %w{candidate_submissions
4
+ experiences
5
+ party_skills
6
+ position_fulfillments
7
+ position_types
8
+ positions
9
+ projects
10
+ shifts
11
+ staffing_positions
12
+ work_effort_party_assignments
13
+ work_efforts
14
+ time_entries
15
+ transportation_routes
16
+ transportation_route_segments
17
+ wc_codes}.each do |table|
18
+
19
+ unless column_exists? table.to_sym, :created_by_party_id
20
+ add_column table.to_sym, :created_by_party_id, :integer
21
+
22
+ add_index table.to_sym, :created_by_party_id, name: "#{table}_created_by_pty_idx"
23
+ end
24
+
25
+ unless column_exists? table.to_sym, :updated_by_party_id
26
+ add_column table.to_sym, :updated_by_party_id, :integer
27
+
28
+ add_index table.to_sym, :updated_by_party_id, name: "#{table}_updated_by_pty_idx"
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+
35
+ def down
36
+ %w{candidate_submissions
37
+ experiences
38
+ party_skills
39
+ position_fulfillments
40
+ position_types
41
+ positions
42
+ projects
43
+ shifts
44
+ staffing_positions
45
+ work_effort_party_assignments
46
+ work_efforts
47
+ time_entries
48
+ transportation_routes
49
+ transportation_route_segments
50
+ wc_codes}.each do |table|
51
+
52
+ if column_exists? table.to_sym, :created_by_party_id
53
+ remove_column table.to_sym, :created_by_party_id
54
+ end
55
+
56
+ if column_exists? table.to_sym, :updated_by_party_id
57
+ remove_column table.to_sym, :updated_by_party_id
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ end
@@ -0,0 +1,34 @@
1
+ class AddCreatedByUpdatedByToSkillType < ActiveRecord::Migration
2
+ def up
3
+ %w{skill_types}.each do |table|
4
+
5
+ unless column_exists? table.to_sym, :created_by_party_id
6
+ add_column table.to_sym, :created_by_party_id, :integer
7
+
8
+ add_index table.to_sym, :created_by_party_id, name: "#{table}_created_by_pty_idx"
9
+ end
10
+
11
+ unless column_exists? table.to_sym, :updated_by_party_id
12
+ add_column table.to_sym, :updated_by_party_id, :integer
13
+
14
+ add_index table.to_sym, :updated_by_party_id, name: "#{table}_updated_by_pty_idx"
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+
21
+ def down
22
+ %w{skill_types}.each do |table|
23
+
24
+ if column_exists? table.to_sym, :created_by_party_id
25
+ remove_column table.to_sym, :created_by_party_id
26
+ end
27
+
28
+ if column_exists? table.to_sym, :updated_by_party_id
29
+ remove_column table.to_sym, :updated_by_party_id
30
+ end
31
+ end
32
+
33
+ end
34
+ end
@@ -3,6 +3,9 @@ require 'erp_orders'
3
3
  require "erp_work_effort/version"
4
4
  require "erp_work_effort/extensions"
5
5
  require "erp_work_effort/engine"
6
+ require "erp_work_effort/config"
7
+ require "erp_work_effort/services/unit_converter"
8
+ require 'savon'
6
9
 
7
10
  module ErpWorkEffort
8
11
  end
@@ -0,0 +1,33 @@
1
+ module ErpWorkEffort
2
+ module Config
3
+ class << self
4
+
5
+ attr_accessor :days_per_month, :days_per_week, :hours_per_day
6
+
7
+ def init!
8
+ @defaults = {
9
+ :@days_per_month => 20,
10
+ :@days_per_week => 5,
11
+ :@hours_per_day => 8
12
+ }
13
+ end
14
+
15
+ def reset!
16
+ @defaults.each do |k,v|
17
+ instance_variable_set(k,v)
18
+ end
19
+ end
20
+
21
+ def configure(&blk)
22
+ @configure_blk = blk
23
+ end
24
+
25
+ def configure!
26
+ @configure_blk.call(self) if @configure_blk
27
+ end
28
+
29
+ end
30
+ init!
31
+ reset!
32
+ end
33
+ end
@@ -2,10 +2,6 @@ module ErpWorkEffort
2
2
  class Engine < Rails::Engine
3
3
  isolate_namespace ErpWorkEffort
4
4
 
5
- initializer "erp_work_effort.merge_public" do |app|
6
- app.middleware.insert_before Rack::Runtime, ::ActionDispatch::Static, "#{root}/public"
7
- end
8
-
9
5
  ActiveSupport.on_load(:active_record) do
10
6
  include ErpWorkEffort::Extensions::ActiveRecord::ActsAsWorkEffort
11
7
  include ErpWorkEffort::Extensions::ActiveRecord::ActsAsRoutable
@@ -0,0 +1,284 @@
1
+ module ErpWorkEffort
2
+ module Services
3
+ class UnitConverter
4
+
5
+ def initialize(unit)
6
+ @unit = unit
7
+ end
8
+
9
+ def <(unit)
10
+ case @unit
11
+ when :ms
12
+ case unit
13
+ when :ms
14
+ false
15
+ else
16
+ true
17
+ end
18
+
19
+ when :mi
20
+ case unit
21
+ when :ms, :mi
22
+ false
23
+ else
24
+ true
25
+ end
26
+
27
+ when :h
28
+ case unit
29
+ when :ms, :mi, :h
30
+ false
31
+ else
32
+ true
33
+ end
34
+ when :w
35
+ case unit
36
+ when :ms, :mi, :h, :w
37
+ false
38
+ else
39
+ true
40
+ end
41
+
42
+ when :d
43
+ case unit
44
+ when :ms, :mi, :h, :d, :w
45
+ false
46
+ else
47
+ true
48
+ end
49
+
50
+ when :mo
51
+ case unit
52
+ when :ms, :mi, :h, :d, :w, :mo
53
+ false
54
+ else
55
+ true
56
+ end
57
+
58
+ when :a
59
+ case unit
60
+ when :ms, :mi, :h, :d, :w, :mo, :a
61
+ false
62
+ else
63
+ true
64
+ end
65
+
66
+ when :y
67
+ false
68
+
69
+ else
70
+ raise 'Unknown interval'
71
+ end
72
+ end
73
+
74
+ def <=(unit)
75
+ if @unit == unit
76
+ true
77
+ else
78
+ self.send('<', unit)
79
+ end
80
+ end
81
+
82
+ def >(unit)
83
+ case @unit
84
+ when :ms
85
+ case unit
86
+ when :ms
87
+ false
88
+ else
89
+ false
90
+ end
91
+
92
+ when :mi
93
+ case unit
94
+ when :ms
95
+ true
96
+ else
97
+ false
98
+ end
99
+
100
+ when :h
101
+ case unit
102
+ when :ms, :mi
103
+ true
104
+ else
105
+ false
106
+ end
107
+
108
+ when :d
109
+ case unit
110
+ when :ms, :mi, :h
111
+ true
112
+ else
113
+ false
114
+ end
115
+
116
+ when :w
117
+ case unit
118
+ when :ms, :mi, :h, :d
119
+ true
120
+ else
121
+ false
122
+ end
123
+
124
+ when :mo
125
+ case unit
126
+ when :ms, :mi, :h, :d, :w
127
+ true
128
+ else
129
+ false
130
+ end
131
+
132
+ when :a
133
+ case unit
134
+ when :ms, :mi, :h, :d, :w, :mo
135
+ true
136
+ else
137
+ false
138
+ end
139
+
140
+ when :y
141
+ false
142
+
143
+ else
144
+ raise 'Unknown interval'
145
+ end
146
+ end
147
+
148
+ def >=(unit)
149
+ if @unit == unit
150
+ true
151
+ else
152
+ self.send('>', unit)
153
+ end
154
+ end
155
+
156
+ class << self
157
+
158
+ # Converts one unit to another
159
+ #
160
+ # @param {Number} amount Amount to convert
161
+ # @param {Symbol} from_unit Unit to convert from
162
+ # @param {Symbol} to_unit Unit to convert to
163
+ def convert_unit(amount, from_unit, to_unit)
164
+ amount = amount.to_f
165
+
166
+ if from_unit != to_unit
167
+ # first convert to seconds
168
+ case from_unit
169
+ when :ms
170
+ amount = (amount / 1000)
171
+ when :mi
172
+ amount = amount * 60
173
+ when :h
174
+ amount = ((amount * 60) * 60)
175
+ when :d
176
+ amount = (((amount * 60) * 60) * ErpWorkEffort::Config.hours_per_day)
177
+ when :w
178
+ amount = ((((amount * 60) * 60) * ErpWorkEffort::Config.hours_per_day) * ErpWorkEffort::Config.days_per_week)
179
+ when :mo
180
+ amount = ((((amount * 60) * 60) * ErpWorkEffort::Config.hours_per_day) * ErpWorkEffort::Config.days_per_month)
181
+ when :a
182
+ amount = (((((amount * 60) * 60) * 24) * ErpWorkEffort::Config.days_per_month) * 3)
183
+ when :y
184
+ amount = ((((((amount * 60) * 60) * 24) * ErpWorkEffort::Config.days_per_month) * 3) * 4)
185
+ else
186
+ raise 'Unknown interval'
187
+ end
188
+
189
+ # then convert to the desired interval
190
+ case to_unit
191
+ when :ms
192
+ amount = (amount * 1000)
193
+ when :mi
194
+ amount = amount / 60
195
+ when :h
196
+ amount = ((amount / 60) / 60)
197
+ when :d
198
+ amount = (((amount / 60) / 60) / ErpWorkEffort::Config.hours_per_day)
199
+ when :w
200
+ amount = ((((amount / 60) / 60) / ErpWorkEffort::Config.hours_per_day) / ErpWorkEffort::Config.days_per_week)
201
+ when :mo
202
+ amount = ((((amount / 60) / 60) / ErpWorkEffort::Config.hours_per_day) / ErpWorkEffort::Config.days_per_month)
203
+ when :a
204
+ amount = ((((amount / 60) / 60) / ErpWorkEffort::Config.days_per_month) / 3)
205
+ when :y
206
+ amount = ((((((amount / 60) / 60) / 24) / ErpWorkEffort::Config.days_per_month) / 3) / 4)
207
+ else
208
+ raise 'Unknown interval'
209
+ end
210
+ end
211
+
212
+ amount
213
+ end
214
+
215
+ # Converts human time interval to unit
216
+ #
217
+ # @param [String] interval Human interval
218
+ # @return [String] unit
219
+ def convert_human_time_interval_to_unit(interval)
220
+ case interval.singularize
221
+ when 'millisecond'
222
+ 'ms'
223
+ when 'second'
224
+ 's'
225
+ when 'minute'
226
+ 'mi'
227
+ when 'hour'
228
+ 'h'
229
+ when 'day'
230
+ 'd'
231
+ when 'week'
232
+ 'w'
233
+ when 'month'
234
+ 'mo'
235
+ when 'quarter'
236
+ 'q'
237
+ when 'year'
238
+ 'y'
239
+ else
240
+ raise 'Unknown interval'
241
+ end
242
+ end
243
+
244
+ # Converts time unit to human readable interval
245
+ #
246
+ # @param [String] unit Time unit
247
+ # @param [Integer] value Value of unit
248
+ # @return [String] Human readable interval
249
+ def convert_time_unit_to_human_time_interval(unit, value)
250
+ description = case unit
251
+ when :ms
252
+ 'millisecond'
253
+ when :s
254
+ 'second'
255
+ when :mi
256
+ 'minute'
257
+ when :h
258
+ 'hour'
259
+ when :d
260
+ 'day'
261
+ when :w
262
+ 'week'
263
+ when :mo
264
+ 'month'
265
+ when :a
266
+ 'quarter'
267
+ when :y
268
+ 'year'
269
+ else
270
+ raise 'Unknown interval'
271
+ end
272
+
273
+ if value > 1
274
+ description = description.pluralize
275
+ end
276
+
277
+ description
278
+ end
279
+
280
+ end
281
+
282
+ end
283
+ end # Services
284
+ end # ErpWorkEffort
@@ -1,7 +1,7 @@
1
1
  module ErpWorkEffort
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 4
4
- MINOR = 0
4
+ MINOR = 2
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].compact.join('.')