[#4420] Remove Deliverable#frequency, assumed to be monthly.

This commit is contained in:
Eric Davis
2010-09-01 20:24:29 -07:00
parent 6a0c6348ed
commit df53f27114
7 changed files with 10 additions and 20 deletions
+1 -7
View File
@@ -1,15 +1,13 @@
# A RetainerDeliverable is an HourlyDeliverable that is renewed at
# regular calendar periods. The Company bills a regular number of
# hours for a hourly rate whereby the budgets are reset over a
# regular cyclical period (often monthly).
# regular cyclical period (monthly).
class RetainerDeliverable < HourlyDeliverable
unloadable
# Associations
# Validations
ValidFrequencies = ["monthly", "quarterly"]
validates_inclusion_of :frequency, :in => ValidFrequencies, :allow_nil => true, :allow_blank => true
# Accessors
@@ -106,10 +104,6 @@ class RetainerDeliverable < HourlyDeliverable
end
end
def self.frequencies_to_select
ValidFrequencies.collect {|f| [l("text_#{f}"), f]}
end
private
def shrink_budgets_to_new_period
-1
View File
@@ -130,7 +130,6 @@
<% end %>
<table>
<%= show_field(deliverable, :frequency, :html_options => {:class => 'deliverable-frequency'}) if deliverable.retainer? %>
<%= show_field(deliverable, :current_period, :html_options => {:class => 'deliverable-current-period'}) if deliverable.retainer? %>
<%= show_field(deliverable, :start_date, :format => :format_date, :html_options => {:class => 'deliverable-start-date'}) %>
<%= show_field(deliverable, :end_date, :format => :format_date, :html_options => {:class => 'deliverable-end-date'}) %>
-2
View File
@@ -8,8 +8,6 @@
<li class="select required" id="deliverable_type_input">
<%= form.label(:type, l(:field_type)) %>
<%= form.select(:type, Deliverable.valid_types_to_select, {:include_blank => false}, {:class => 'type'}) %>
<%= form.select(:frequency, RetainerDeliverable.frequencies_to_select, :include_blank => false) %>
</li>
<% else %>
<%= form.input :type, :as => :hidden, :class => 'type' %>
-3
View File
@@ -61,9 +61,6 @@ en:
field_deliverable_title: "Deliverable"
field_contract_name: "Contract"
field_contract: "Contract"
field_frequency: "Frequency"
text_monthly: "Monthly"
text_quarterly: "Quarterly"
text_start_date_empty: "The start date is empty. If this form is submitted, no budget items will be created."
text_end_date_empty: "The end date is empty. If this form is submitted, no budget items will be created."
text_missing_period: "This deliverable is missing a date range so it cannot have budget items. Please save start and end dates before adding any budget items."
@@ -0,0 +1,9 @@
class RemoveFrequencyFromDeliverables < ActiveRecord::Migration
def self.up
remove_column :deliverables, :frequency
end
def self.down
add_column :deliverables, :frequency, :string
end
end
@@ -122,7 +122,6 @@ class DeliverablesNewTest < ActionController::IntegrationTest
fill_in "Title", :with => 'A New Deliverable'
select "Retainer", :from => "Type"
select "Monthly", :from => 'deliverable_frequency'
select @manager.name, :from => "Manager"
fill_in "Start", :with => '2010-01-01'
fill_in "End Date", :with => '2010-12-31'
@@ -150,7 +149,6 @@ class DeliverablesNewTest < ActionController::IntegrationTest
assert_equal '2010-01-01', @deliverable.start_date.to_s
assert_equal '2010-12-31', @deliverable.end_date.to_s
assert_equal @manager, @deliverable.manager
assert_equal "monthly", @deliverable.frequency
# Budget items, one per month
labor_budgets = @deliverable.labor_budgets
-5
View File
@@ -5,11 +5,6 @@ class RetainerDeliverableTest < ActiveSupport::TestCase
assert_equal HourlyDeliverable, RetainerDeliverable.superclass
end
context "#frequency" do
should_allow_values_for(:frequency, nil, '', 'monthly', 'quarterly')
should_not_allow_values_for(:frequency, 'anything', 'else', 'weekly')
end
context "#months" do
should "be an array of months the Deliverable is active in" do
d = RetainerDeliverable.new(:start_date => Date.today.beginning_of_month,