From 726c3363c730099a81621f0bbfb415c23e26f013 Mon Sep 17 00:00:00 2001
From: Kat
Date: Fri, 22 Apr 2022 09:40:53 +0100
Subject: [PATCH] display when log is completed
---
app/views/case_logs/_tasklist.html.erb | 6 +-----
app/views/case_logs/edit.html.erb | 5 +++++
app/views/form/review.html.erb | 6 +++---
spec/features/form/tasklist_page_spec.rb | 16 ++++++++++++----
spec/requests/form_controller_spec.rb | 1 -
5 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/app/views/case_logs/_tasklist.html.erb b/app/views/case_logs/_tasklist.html.erb
index a1ae6d2f6..b371a361f 100644
--- a/app/views/case_logs/_tasklist.html.erb
+++ b/app/views/case_logs/_tasklist.html.erb
@@ -23,8 +23,4 @@
<% end %>
-
-
-Review and submit
-Review your answers and submit this log to the Department of Levelling Up, Housing & Communities.
-<%= govuk_button_link_to 'Review lettings log', "/logs/#{@case_log.id}/review" %>
\ No newline at end of file
+
\ No newline at end of file
diff --git a/app/views/case_logs/edit.html.erb b/app/views/case_logs/edit.html.erb
index 26f3509d3..438002338 100644
--- a/app/views/case_logs/edit.html.erb
+++ b/app/views/case_logs/edit.html.erb
@@ -24,6 +24,11 @@
<% elsif @case_log.status == "not_started" %>
This log has not been started.
+ <% elsif @case_log.status == "completed" %>
+ Completed
+
+ You can ">review and make changes to this log up to 3 months after the end of the current collection year, which closes on 31 March <%= @case_log.collection_start_year.present? ? @case_log.collection_start_year + 1 : "" %>.
+
<% end %>
<%= render "tasklist" %>
diff --git a/app/views/form/review.html.erb b/app/views/form/review.html.erb
index c4f058400..2bfb8f9e3 100644
--- a/app/views/form/review.html.erb
+++ b/app/views/form/review.html.erb
@@ -10,6 +10,9 @@
<%= content_for(:title) %>
+
+ You can review and make changes to this log up to 3 months after the end of the current collection year, which closes on 31 March <%= @case_log.collection_start_year.present? ? @case_log.collection_start_year + 1 : "" %>.
+
<% @case_log.form.sections.map do |section| %>
<%= section.label %>
<% section.subsections.map do |subsection| %>
@@ -27,8 +30,5 @@
<% end %>
<% end %>
-
- You can submit changes to this log until the close of the current collection year, 31 March <%= @case_log.collection_start_year.present? ? @case_log.collection_start_year + 1 : " of current collection end year" %>.
-
\ No newline at end of file
diff --git a/spec/features/form/tasklist_page_spec.rb b/spec/features/form/tasklist_page_spec.rb
index 39cbe63eb..70d770371 100644
--- a/spec/features/form/tasklist_page_spec.rb
+++ b/spec/features/form/tasklist_page_spec.rb
@@ -12,6 +12,14 @@ RSpec.describe "Task List" do
managing_organisation: user.organisation,
)
end
+ let(:completed_case_log) do
+ FactoryBot.create(
+ :case_log,
+ :completed,
+ owning_organisation: user.organisation,
+ managing_organisation: user.organisation,
+ )
+ end
let(:empty_case_log) do
FactoryBot.create(
:case_log,
@@ -44,9 +52,9 @@ RSpec.describe "Task List" do
end
it "has a review section which has a button that allows the data inputter to review the case log" do
- visit("/logs/#{case_log.id}")
- expect(page).to have_content("Review your answers and submit this log to the Department of Levelling Up, Housing & Communities.")
- click_link(text: "Review lettings log")
- expect(page).to have_current_path("/logs/#{case_log.id}/review")
+ visit("/logs/#{completed_case_log.id}")
+ expect(page).to have_content("review and make changes to this log")
+ click_link(text: "review and make changes to this log")
+ expect(page).to have_current_path("/logs/#{completed_case_log.id}/review")
end
end
diff --git a/spec/requests/form_controller_spec.rb b/spec/requests/form_controller_spec.rb
index 552d1c359..3d9f9cf64 100644
--- a/spec/requests/form_controller_spec.rb
+++ b/spec/requests/form_controller_spec.rb
@@ -23,7 +23,6 @@ RSpec.describe FormController, type: :request do
:case_log,
:about_completed,
status: 1,
- year: 2021,
startdate: Time.zone.local(2021, 10, 10),
owning_organisation: organisation,
managing_organisation: organisation,