Mongo scopes
This commit is contained in:
parent
908d8492f7
commit
861c12aa32
|
@ -11,8 +11,8 @@ require 'burden/wrapper'
|
|||
module Burden
|
||||
include Config::Helper
|
||||
|
||||
def wrap(name, description, &block)
|
||||
Wrapper.new(name, description, block).execute
|
||||
def wrap(name, &block)
|
||||
Wrapper.new(name, block).execute
|
||||
end
|
||||
|
||||
extend self
|
||||
|
|
|
@ -5,7 +5,7 @@ module Burden
|
|||
self.table_name = 'burden_runs'
|
||||
attr_accessible :name, :success, :execution_time
|
||||
|
||||
scope :summary, ->{ group(:name).order('created_at desc') }
|
||||
scope :summary, ->{ order('created_at desc').group(:name) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,6 +8,8 @@ module Burden
|
|||
key :name, String
|
||||
key :success, Boolean
|
||||
key :execution_time, Float
|
||||
|
||||
scope :summary, ->{ sort(:created_at.desc).group_by(&:name) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,6 +8,8 @@ module Burden
|
|||
field :name, type: String
|
||||
field :success, type: Boolean
|
||||
field :execution_time, type: Float
|
||||
|
||||
scope :summary, ->{ sort(created_at: -1).group_by(&:name) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,9 +3,7 @@ module Rake
|
|||
alias_method :original_execute, :execute
|
||||
|
||||
def execute(args)
|
||||
Burden.wrap(name, comment) do
|
||||
original_execute(args)
|
||||
end
|
||||
Burden.wrap(name){ original_execute(args) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue