Renamed Deliverable.due_date to due so it doesn't conflict with issue.due_date

This commit is contained in:
Eric Davis
2008-06-03 17:36:57 -07:00
parent 490bf73efe
commit 23c6ee6e92
8 changed files with 43 additions and 17 deletions

View File

@@ -15,7 +15,7 @@ class Budget
del = self.deliverables
return nil unless del.size > 0
dates = del.collect(&:due_date).delete_if { |d| d.blank?}
dates = del.collect(&:due).delete_if { |d| d.blank?}
return dates.sort[0]
end
@@ -24,7 +24,7 @@ class Budget
del = self.deliverables
return nil unless del.size > 0
dates = del.collect(&:due_date).delete_if { |d| d.blank?}
dates = del.collect(&:due).delete_if { |d| d.blank?}
return dates.sort[-1]
end

View File

@@ -5,7 +5,7 @@
<%= content_tag(:td, h(deliverable.subject), :class => 'subject') %>
<%= content_tag(:td, number_to_currency(deliverable.budget, :precision => 0), :class => 'budget') %>
<%= content_tag(:td, number_to_currency(deliverable.spent, :precision => 0), :class => 'spent') %>
<%= content_tag(:td, format_date(deliverable.due_date), :class => 'due_date') %>
<%= content_tag(:td, format_date(deliverable.due), :class => 'due_date') %>
<%= content_tag(:td, progress_bar(deliverable.progress, :width => '100%', :class => 'dont_ratio')) %>
<%= content_tag(:td, link_to_function("Details", "$('deliverable-details-#{deliverable.id}').toggle();"), :class => 'actions') %>
</tr>

View File

@@ -7,7 +7,7 @@
:rows => (@deliverable.description.blank? ? 10 : [[10, @deliverable.description.length / 50].max, 100].min),
:accesskey => accesskey(:edit),
:class => 'wiki-edit' %></p>
<p><%= f.text_field :due_date, :size => 10 %><%= calendar_for('deliverable_due_date') %></p>
<p><%= f.text_field :due, :size => 10 %><%= calendar_for('deliverable_due') %></p>
<p><%= f.check_box(:project_manager_signoff) %></p>
<p><%= f.check_box(:client_signoff) %></p>

View File

@@ -5,7 +5,7 @@
<%= sort_header_tag("#{Deliverable.table_name}.subject", :caption => 'Subject') %>
<%= sort_header_tag("#{Deliverable.table_name}.budget", :caption => 'Budget') %>
<%= sort_header_tag("spent", :caption => 'Spent') %>
<%= sort_header_tag("#{Deliverable.table_name}.due_date", :caption => 'Due') %>
<%= sort_header_tag("#{Deliverable.table_name}.due", :caption => 'Due') %>
<%= sort_header_tag("progress", :caption => 'Progress') %>
<%= content_tag('th', "Actions") %>
</tr></thead>

View File

@@ -0,0 +1,25 @@
class RenameDueDateToDue < ActiveRecord::Migration
def self.up
add_column :deliverables, :due, :date
Deliverable.reset_column_information
Deliverable.find(:all).each do |deliverable|
deliverable.update_attribute(:due, deliverable.due_date)
end
remove_column :deliverables, :due_date
end
def self.down
add_column :deliverables, :due_date, :date
Deliverable.reset_column_information
Deliverable.find(:all).each do |deliverable|
deliverable.update_attribute(:due_date, deliverable.due)
end
remove_column :deliverables, :due
end
end

View File

@@ -9,5 +9,6 @@ field_project_manager_signoff: Project Manager Signoff
field_client_signoff: Client Signoff
field_deliverable: Deliverable
field_deliverable_subject: Deliverable
field_due: Due Date
label_member_rate: Rate ($)
message_updated_issues: Updated %d issues

View File

@@ -52,8 +52,8 @@ describe Budget, '.next_due_date' do
@tomorrow = Date.today + 1.days
@next_week = Date.today + 7.days
@deliverable1 = mock_model(Deliverable, :project_id => @project, :due_date => @next_week)
@deliverable2 = mock_model(Deliverable, :project_id => @project, :due_date => @tomorrow)
@deliverable1 = mock_model(Deliverable, :project_id => @project, :due => @next_week)
@deliverable2 = mock_model(Deliverable, :project_id => @project, :due => @tomorrow)
@project = mock_model(Project)
Deliverable.stub!(:find_all_by_project_id).and_return([@deliverable1, @deliverable2])
@@ -77,8 +77,8 @@ describe Budget, '.next_due_date' do
@tomorrow = Date.today + 1.days
@next_week = Date.today + 7.days
@deliverable1 = mock_model(Deliverable, :project_id => @project, :due_date => @next_week)
@deliverable2 = mock_model(Deliverable, :project_id => @project, :due_date => nil)
@deliverable1 = mock_model(Deliverable, :project_id => @project, :due => @next_week)
@deliverable2 = mock_model(Deliverable, :project_id => @project, :due => nil)
@project = mock_model(Project)
Deliverable.stub!(:find_all_by_project_id).and_return([@deliverable1, @deliverable2])
@@ -93,8 +93,8 @@ describe Budget, '.next_due_date' do
@tomorrow = Date.today + 1.days
@next_week = Date.today + 7.days
@deliverable1 = mock_model(Deliverable, :project_id => @project, :due_date => @next_week)
@deliverable2 = mock_model(Deliverable, :project_id => @project, :due_date => '')
@deliverable1 = mock_model(Deliverable, :project_id => @project, :due => @next_week)
@deliverable2 = mock_model(Deliverable, :project_id => @project, :due => '')
@project = mock_model(Project)
Deliverable.stub!(:find_all_by_project_id).and_return([@deliverable1, @deliverable2])
@@ -111,8 +111,8 @@ describe Budget, '.final_due_date' do
@tomorrow = Date.today + 1.days
@next_week = Date.today + 7.days
@deliverable1 = mock_model(Deliverable, :project_id => @project, :due_date => @next_week)
@deliverable2 = mock_model(Deliverable, :project_id => @project, :due_date => @tomorrow)
@deliverable1 = mock_model(Deliverable, :project_id => @project, :due => @next_week)
@deliverable2 = mock_model(Deliverable, :project_id => @project, :due => @tomorrow)
@project = mock_model(Project)
Deliverable.stub!(:find_all_by_project_id).and_return([@deliverable1, @deliverable2])
@@ -136,8 +136,8 @@ describe Budget, '.final_due_date' do
@tomorrow = Date.today + 1.days
@next_week = Date.today + 7.days
@deliverable1 = mock_model(Deliverable, :project_id => @project, :due_date => @next_week)
@deliverable2 = mock_model(Deliverable, :project_id => @project, :due_date => nil)
@deliverable1 = mock_model(Deliverable, :project_id => @project, :due => @next_week)
@deliverable2 = mock_model(Deliverable, :project_id => @project, :due => nil)
@project = mock_model(Project)
Deliverable.stub!(:find_all_by_project_id).and_return([@deliverable1, @deliverable2])
@@ -152,8 +152,8 @@ describe Budget, '.final_due_date' do
@tomorrow = Date.today + 1.days
@next_week = Date.today + 7.days
@deliverable1 = mock_model(Deliverable, :project_id => @project, :due_date => @next_week)
@deliverable2 = mock_model(Deliverable, :project_id => @project, :due_date => '')
@deliverable1 = mock_model(Deliverable, :project_id => @project, :due => @next_week)
@deliverable2 = mock_model(Deliverable, :project_id => @project, :due => '')
@project = mock_model(Project)
Deliverable.stub!(:find_all_by_project_id).and_return([@deliverable1, @deliverable2])

0
spec/rcov.opts Normal file
View File