diff --git a/app/models/retainer_deliverable.rb b/app/models/retainer_deliverable.rb index 04563fd..543b892 100644 --- a/app/models/retainer_deliverable.rb +++ b/app/models/retainer_deliverable.rb @@ -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 diff --git a/app/views/contracts/show.html.erb b/app/views/contracts/show.html.erb index c0fbf20..f7a3da4 100644 --- a/app/views/contracts/show.html.erb +++ b/app/views/contracts/show.html.erb @@ -131,6 +131,7 @@ <%= 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'}) %>
diff --git a/test/unit/retainer_deliverable_test.rb b/test/unit/retainer_deliverable_test.rb index 45112de..e079dcb 100644 --- a/test/unit/retainer_deliverable_test.rb +++ b/test/unit/retainer_deliverable_test.rb @@ -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