Fixed bug in changeset closing and querying where the number of elements exceeded the maximum. Added a fixture for this.
This commit is contained in:
parent
509832c5b3
commit
76708eefcf
5 changed files with 40 additions and 9 deletions
|
@ -395,8 +395,14 @@ private
|
|||
|
||||
##
|
||||
# restrict changes to those which are open
|
||||
#
|
||||
# at the moment this code assumes we're only interested in open
|
||||
# changesets and gives no facility to query closed changesets. this
|
||||
# would be reasonably simple to implement if anyone actually wants
|
||||
# it?
|
||||
def conditions_open(open)
|
||||
return open.nil? ? nil : ['closed_at >= ?', DateTime.now]
|
||||
return open.nil? ? nil : ['closed_at >= ? and num_changes <= ?',
|
||||
DateTime.now, Changeset::MAX_ELEMENTS]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -46,7 +46,7 @@ class Changeset < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def set_closed_time_now
|
||||
unless is_open?
|
||||
if is_open?
|
||||
self.closed_at = Time.now
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue