Permalink
Browse files

Merge remote branch 'origin/appeal_a_benefit_decision_amends'

  • Loading branch information...
2 parents 9edce7b + 9718630 commit 00c6abfb2335b49048c6b184e2bcb9d52e7d05c3 @alext alext committed Jul 30, 2012
@@ -22,11 +22,10 @@
from { 5.years.ago }
to { Date.today }
save_input_as :decision_letter_date
+
next_node do |response|
-
decision_date = Date.parse(response)
appeal_expiry_date = decision_appeal_limit_in_months.months.since(decision_date)
-
if Date.today < appeal_expiry_date
:had_written_explanation?
else
@@ -40,6 +39,22 @@
option :spoken_explanation
option :written_explanation
option :no
+
+ calculate :appeal_expiry_date do
+ decision_date = Date.parse(decision_letter_date)
+ if (decision_date > 1.month.ago.to_date)
+ 1.month.since(decision_date)
+ end
+ end
+
+ calculate :appeal_expiry_text do
+ if appeal_expiry_date
+ "You have until #{appeal_expiry_date.to_s(:long)} to start an appeal"
+ else
+ ""
+ end
+ end
+
next_node do |response|
if response == 'written_explanation'
:when_did_you_ask_for_it?
@@ -68,18 +83,42 @@
# Q6
date_question :when_did_you_get_it? do
+ save_input_as :written_explanation_received_date
from { 5.years.ago }
to { Date.today }
- next_node do |response|
+
+ calculate :appeal_expiry_date do
+ decision_date = Date.parse(decision_letter_date)
+ received_date = Date.parse(responses.last)
+ received_within_a_month = received_date < 1.month.since(Date.parse(written_explanation_request_date))
+ if received_within_a_month
+ expiry_date = 1.fortnight.since(1.month.since(decision_date))
+ else
+ expiry_date = 1.fortnight.since(received_date)
+ end
+ if Date.today < expiry_date
+ expiry_date
+ end
+ end
+
+ calculate :appeal_expiry_text do
+ if appeal_expiry_date
+ "You have until #{appeal_expiry_date.to_s(:long)} to start an appeal"
+ else
+ ""
+ end
+ end
+
+ next_node do |response|
received_date = Date.parse(response)
- received_within_a_month = 1.month.since(received_date) > Date.parse(written_explanation_request_date)
+ received_within_a_month = received_date < 1.month.since(Date.parse(written_explanation_request_date))
a_fortnight_has_passed = Date.today > 1.fortnight.since(received_date)
decision_date = Date.parse(decision_letter_date)
a_month_and_a_fortnight_since_decision = Date.today > 1.fortnight.since(1.month.since(decision_date))
- if (received_within_a_month and a_fortnight_has_passed) or
- (!received_within_a_month and a_month_and_a_fortnight_since_decision)
+ if (!received_within_a_month and a_fortnight_has_passed) or
+ (received_within_a_month and a_month_and_a_fortnight_since_decision)
:special_circumstances?
else
:asked_to_reconsider?
@@ -87,6 +87,8 @@ en-GB:
Sometimes, the benefits office will change a decision about your benefits if you ask them to look at it again (reconsider).
You don't have to ask them to reconsider before you appeal. If you don't think you'll have enough time before the deadline, you might want to skip this stage and start an appeal straight away.
+
+ %{appeal_expiry_text}
options:
"yes": "Yes, or want to skip this stage"
"no": "No"
@@ -60,6 +60,7 @@ class AppealABenefitsDecisionTest < ActiveSupport::TestCase
should "say 'cant challenge or appeal'" do
add_response 13.months.ago.to_date
assert_current_node :cant_challenge_or_appeal
+ assert_state_variable("appeal_expiry_date", nil)
end
end
@@ -80,6 +81,11 @@ class AppealABenefitsDecisionTest < ActiveSupport::TestCase
should "ask 'have you been asked to reconsider?'" do
assert_current_node :asked_to_reconsider?
end
+
+ should "calculate the appeal expiry date" do
+ assert_state_variable("appeal_expiry_date", 1.month.since(7.days.ago.to_date))
+ end
+
end
context "answer 'spoken explanation' to 'had written explanation?' when letter date was more than a month ago" do
@@ -91,6 +97,7 @@ class AppealABenefitsDecisionTest < ActiveSupport::TestCase
should "ask 'special circumstances?'" do
assert_current_node :special_circumstances?
end
+
end
context "answer 'no' to 'had written explanation?' when letter date was less than a month ago" do
@@ -151,6 +158,10 @@ class AppealABenefitsDecisionTest < ActiveSupport::TestCase
should "ask 'asked to reconsider?'" do
assert_current_node :asked_to_reconsider?
end
+
+ should "calculate the appeal expiry date" do
+ assert_state_variable("appeal_expiry_date", 1.fortnight.since(1.month.since(1.month.ago.to_date)))
+ end
end
end
@@ -183,6 +194,7 @@ class AppealABenefitsDecisionTest < ActiveSupport::TestCase
context "the statement was received after one month and 14 days have since passed" do
setup do
add_response 15.days.ago # Statement received 15 days ago
+ assert_state_variable("appeal_expiry_date", nil)
end
# Q7
@@ -227,6 +239,11 @@ class AppealABenefitsDecisionTest < ActiveSupport::TestCase
should "ask 'asked to reconsider?'" do
assert_current_node :asked_to_reconsider?
end
+
+ should "calculate the appeal expiry date" do
+ assert_state_variable("appeal_expiry_date", 1.fortnight.since(7.days.ago).to_date)
+ end
+
end
end

0 comments on commit 00c6abf

Please sign in to comment.