bookie_accounting 0.0.1 → 0.0.2

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.
@@ -74,39 +74,39 @@ module Bookie
74
74
  #Filters by group name
75
75
  def self.by_group_name(group_name)
76
76
  group = Group.find_by_name(group_name)
77
- return joins(:user).where('group_id = ?', group.id) if group
77
+ return joins(:user).where('users.group_id = ?', group.id) if group
78
78
  limit(0)
79
79
  end
80
80
 
81
81
  ##
82
82
  #Filters by system type
83
83
  def self.by_system_type(system_type)
84
- joins(:system).where('system_type_id = ?', system_type.id)
84
+ joins(:system).where('systems.system_type_id = ?', system_type.id)
85
85
  end
86
86
 
87
87
  ##
88
88
  #Filters by command name
89
89
  def self.by_command_name(c_name)
90
- where('command_name = ?', c_name)
90
+ where('jobs.command_name = ?', c_name)
91
91
  end
92
92
 
93
93
  ##
94
94
  #Filters by a range of start times
95
95
  def self.by_start_time_range(start_min, start_max)
96
- where('? <= start_time AND start_time < ?', start_min, start_max)
96
+ where('? <= jobs.start_time AND jobs.start_time < ?', start_min, start_max)
97
97
  end
98
98
 
99
99
  ##
100
100
  #Filters by a range of end times
101
101
  def self.by_end_time_range(end_min, end_max)
102
- where('? <= end_time AND end_time < ?', end_min, end_max)
102
+ where('? <= jobs.end_time AND jobs.end_time < ?', end_min, end_max)
103
103
  end
104
104
 
105
105
  ##
106
106
  #Finds all jobs whose running intervals overlap the given time range
107
107
  def self.by_time_range_inclusive(min_time, max_time)
108
108
  raise ArgumentError.new('Max time must be greater than or equal to min time') if max_time < min_time
109
- where('start_time < ? AND end_time > ?', max_time, min_time)
109
+ where('jobs.start_time < ? AND jobs.end_time > ?', max_time, min_time)
110
110
  end
111
111
 
112
112
  ##
@@ -126,7 +126,7 @@ module Bookie
126
126
  raise ArgumentError.new('Max time must be specified with min time') unless max_time
127
127
  jobs = jobs.by_time_range_inclusive(min_time, max_time)
128
128
  end
129
- jobs = jobs.where('cpu_time > 0').all_with_relations
129
+ jobs = jobs.where('jobs.cpu_time > 0').all_with_relations
130
130
  wall_time = 0
131
131
  cpu_time = 0
132
132
  successful_jobs = 0
@@ -299,19 +299,19 @@ module Bookie
299
299
  ##
300
300
  #Finds all systems that are active (i.e. all systems with NULL values for end_time)
301
301
  def self.active_systems
302
- where('end_time IS NULL')
302
+ where('systems.end_time IS NULL')
303
303
  end
304
304
 
305
305
  ##
306
306
  #Filters by name
307
307
  def self.by_name(name)
308
- where('name = ?', name)
308
+ where('systems.name = ?', name)
309
309
  end
310
310
 
311
311
  ##
312
312
  #Filters by system type
313
313
  def self.by_system_type(sys_type)
314
- where('system_type_id = ?', sys_type.id)
314
+ where('systems.system_type_id = ?', sys_type.id)
315
315
  end
316
316
 
317
317
  ##
@@ -361,7 +361,7 @@ module Bookie
361
361
  raise ArgumentError.new('Max time must be greater than or equal to min time') if max_time < min_time
362
362
  #To consider: optimize as union of queries?
363
363
  systems = systems.where(
364
- 'start_time < ? AND (end_time IS NULL OR end_time > ?)',
364
+ 'systems.start_time < ? AND (systems.end_time IS NULL OR systems.end_time > ?)',
365
365
  max_time,
366
366
  min_time)
367
367
  end
@@ -389,7 +389,7 @@ module Bookie
389
389
  first_started_system = systems.order(:start_time).first
390
390
  if first_started_system
391
391
  #Is there a system still active?
392
- last_ended_system = systems.where('end_time IS NULL').first
392
+ last_ended_system = systems.where('systems.end_time IS NULL').first
393
393
  if last_ended_system
394
394
  wall_time_range = current_time.to_i - first_started_system.start_time.to_i
395
395
  else
@@ -1,4 +1,4 @@
1
1
  module Bookie
2
2
  #The library version
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bookie_accounting
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-21 00:00:00.000000000 Z
12
+ date: 2013-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json