Browse Source
* refactor with extract method * can filter logs by bulk upload * hide log creation button when viewing bulk upload - this affects the logs index page filtering logs from a specific bulk upload * add info banner to bulk upload logs * placeholder for bulk upload logs header * when resuming bulk upload set filters * fill place holder with remaining logs to fix * add interstitial to resume if logs resolved * after resolving bulk upload logs show interstitial * fix linting error * extract view variable to helper methodpull/1239/head v0.2.35
Phil Lee
2 years ago
committed by
GitHub
14 changed files with 344 additions and 59 deletions
@ -0,0 +1,11 @@ |
|||||||
|
<div class="govuk-grid-row"> |
||||||
|
<div class="govuk-grid-column-two-thirds"> |
||||||
|
<h1 class="govuk-heading-xl">There are no more logs that need updating</h1> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
|
||||||
|
<p class="govuk-body-l"> |
||||||
|
You’ve completed all the logs that had errors from your bulk upload. |
||||||
|
</p> |
||||||
|
|
||||||
|
<%= govuk_button_link_to "Back to all logs", lettings_logs_path, button: true %> |
@ -0,0 +1,68 @@ |
|||||||
|
require "rails_helper" |
||||||
|
|
||||||
|
RSpec.describe BulkUploadLettingsResultsController do |
||||||
|
before do |
||||||
|
sign_in user |
||||||
|
end |
||||||
|
|
||||||
|
describe "GET #resume /lettings-logs/bulk-upload-results/:ID/resume" do |
||||||
|
let(:user) { create(:user) } |
||||||
|
let(:bulk_upload) { create(:bulk_upload, :lettings, user:) } |
||||||
|
|
||||||
|
context "when there are no logs left to resolve" do |
||||||
|
render_views |
||||||
|
|
||||||
|
it "displays copy to user" do |
||||||
|
get :resume, params: { id: bulk_upload.id } |
||||||
|
|
||||||
|
expect(response.body).to include("There are no more logs that need updating") |
||||||
|
end |
||||||
|
|
||||||
|
it "resets logs filters" do |
||||||
|
get :resume, params: { id: bulk_upload.id } |
||||||
|
|
||||||
|
expect(JSON.parse(session["logs_filters"])).to eql({}) |
||||||
|
end |
||||||
|
end |
||||||
|
|
||||||
|
context "when there are logs left to resolve" do |
||||||
|
before do |
||||||
|
create(:lettings_log, :in_progress, bulk_upload:) |
||||||
|
end |
||||||
|
|
||||||
|
it "clears the year filter" do |
||||||
|
hash = { |
||||||
|
years: ["", "2022"], |
||||||
|
} |
||||||
|
|
||||||
|
session["logs_filters"] = hash.to_json |
||||||
|
|
||||||
|
get :resume, params: { id: bulk_upload.id } |
||||||
|
|
||||||
|
expect(JSON.parse(session["logs_filters"])["years"]).to eql([""]) |
||||||
|
end |
||||||
|
|
||||||
|
it "sets the status filter to in progress" do |
||||||
|
session["logs_filters"] ||= {}.to_json |
||||||
|
|
||||||
|
get :resume, params: { id: bulk_upload.id } |
||||||
|
|
||||||
|
expect(JSON.parse(session["logs_filters"])["status"]).to eql(["", "in_progress"]) |
||||||
|
end |
||||||
|
|
||||||
|
it "sets the user filter to all" do |
||||||
|
session["logs_filters"] ||= {}.to_json |
||||||
|
|
||||||
|
get :resume, params: { id: bulk_upload.id } |
||||||
|
|
||||||
|
expect(JSON.parse(session["logs_filters"])["user"]).to eql("all") |
||||||
|
end |
||||||
|
|
||||||
|
it "redirects to logs with bulk upload filter applied" do |
||||||
|
get :resume, params: { id: bulk_upload.id } |
||||||
|
|
||||||
|
expect(response).to redirect_to("/lettings-logs?bulk_upload_id%5B%5D=#{bulk_upload.id}") |
||||||
|
end |
||||||
|
end |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue