All tests run

pull/6827/head
friflaj 14 years ago
parent 85d00ffb13
commit 1c14ae258d
  1. 13
      app/models/story.rb
  2. 17
      app/models/task.rb
  3. 2
      features/step_definitions/_when_steps.rb

@ -45,8 +45,19 @@ class Story < Issue
end
def self.find_all_updated_since(since, project_id)
# different databases do date-to-string comparisons in different
# ways
if ! (since.is_a?(Date) || since.is_a?(DateTime))
since = since.to_s
if since.match(/:/)
since = DateTime.strptime(since, '%Y-%m-%d %H:%M:%S')
else
since = Date.strptime(since, '%Y-%m-%d')
end
end
find(:all,
:conditions => ["project_id=(?) AND updated_on > ? AND tracker_id in (?)", project_id, since, trackers],
:conditions => ["project_id = ? AND updated_on > ? AND tracker_id in (?)", project_id, since, trackers],
:order => "updated_on ASC")
end

@ -1,3 +1,5 @@
require 'date'
class Task < Issue
unloadable
@ -30,9 +32,22 @@ class Task < Issue
return task
end
# TODO: there's an assumption here that impediments always have the
# task-tracker as their tracker.
def self.find_all_updated_since(since, project_id, find_impediments = false)
# different databases do date-to-string comparisons in different
# ways
if ! (since.is_a?(Date) || since.is_a?(DateTime))
since = since.to_s
if since.match(/:/)
since = DateTime.strptime(since, '%Y-%m-%d %H:%M:%S')
else
since = Date.strptime(since, '%Y-%m-%d')
end
end
find(:all,
:conditions => ["project_id=(?) AND updated_on > ? AND tracker_id in (?) and parent_id IS #{ find_impediments ? '' : 'NOT' } NULL", project_id, since, tracker],
:conditions => ["project_id = ? AND updated_on > ? AND tracker_id in (?) and parent_id IS #{ find_impediments ? '' : 'NOT' } NULL", project_id, since, tracker],
:order => "updated_on ASC")
end

@ -131,5 +131,5 @@ end
When /^the browser fetches (.+) updated since (\d+) (\w+) (.+)$/ do |object_type, how_many, period, direction|
date = eval("#{ how_many }.#{ period }.#{ direction=='from now' ? 'from_now' : 'ago' }")
visit url_for(:controller => 'rb_updated_items', :action => :show, :id => @project.id, :only => object_type, :since => date.strftime("%B %d, %Y %H:%M:%S") + '.' + (date.to_f % 1).to_s.split('.')[1])
visit url_for(:controller => 'rb_updated_items', :action => :show, :id => @project.id, :only => object_type, :since => date.strftime("%Y-%m-%d %H:%M:%S"))
end

Loading…
Cancel
Save