[#4420] Started on the Retainer's periods, only pending tests for now.

This commit is contained in:
Eric Davis
2010-08-16 15:06:08 -07:00
parent 4b162f85bf
commit f899b4e623
3 changed files with 38 additions and 0 deletions

View File

@@ -19,6 +19,10 @@ class RetainerDeliverable < HourlyDeliverable
'R'
end
def current_period
'TODO'
end
def self.frequencies_to_select
ValidFrequencies.collect {|f| [l("text_#{f}"), f]}
end

View File

@@ -131,6 +131,7 @@
<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'}) %>
</table>

View File

@@ -9,4 +9,37 @@ class RetainerDeliverableTest < ActiveSupport::TestCase
should_allow_values_for(:frequency, nil, '', 'monthly', 'quarterly')
should_not_allow_values_for(:frequency, 'anything', 'else', 'weekly')
end
# TODO: Question: Fit to calendar or based on N days?
# Monthly => June-June or June 5th-July 5th
# Quarterly => Jan-March 31 or Feb-May 31
context "#current_period" do
context "monthly frequency" do
should "be a range of the current month"
end
context "quarterly frequency" do
should "be a range of the current quarter"
end
end
context "#start_of_current_period" do
context "monthly frequency" do
should "QUESTION: be the first day of the month or 30 days ago"
end
context "quarterly frequency" do
should "QUESTION: be the first day of the quarter or 365/4 days ago"
end
end
context "#end_of_current_period" do
context "monthly frequency" do
should "QUESTION: be the first day of the month or 30 days ago"
end
context "quarterly frequency" do
should "QUESTION: be the first day of the quarter or 365/4 days ago"
end
end
end