Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fc 1785 86 87 93 av #2745

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8d7514f
Update of the validation process step 2
AnneV-Learn Jun 28, 2024
36f85ae
Update freecen_csv_processor.rb
AnneV-Learn Jun 30, 2024
e66a04a
Update freecen_csv_processor.rb
AnneV-Learn Jun 30, 2024
b858ce0
feat: update scss
jayto581 Jul 3, 2024
12d7454
feat: improve layout
jayto581 Jul 3, 2024
2ada32a
feat: add accessibility link
jayto581 Jul 3, 2024
f595599
feat: update footer layout
jayto581 Jul 3, 2024
194faf0
feat: update members page
jayto581 Jul 12, 2024
e4b2ed6
Merge branch 'master' into fc_1786_2_av
AnneV-Learn Jul 19, 2024
c1b324f
Once a POB is Propagated for a CSV record the 'Propagate Alternative …
AnneV-Learn Jul 19, 2024
a85994d
Merge branch 'fc_1793_av' into fc_1785_86_87_93_av
AnneV-Learn Jul 22, 2024
8eda99d
Merge branch 'master' into fc_1785_86_87_93_av
AnneV-Learn Jul 24, 2024
4e682e9
Initial Coding to include Step 3 (1787)
AnneV-Learn Jul 24, 2024
70f91a5
Updates after clarification of propagation restrictions
AnneV-Learn Jul 29, 2024
c850164
Merge branch 'master' into fc_1785_86_87_93_av
AnneV-Learn Aug 2, 2024
67cd8ff
Update propagation scope so that HAM includes IOW and YRKS includes E…
AnneV-Learn Aug 2, 2024
3db8fa9
Update freecen_csv_entry.rb
AnneV-Learn Aug 2, 2024
4fc78d8
Adjust number of warning records for the CSV file
AnneV-Learn Aug 3, 2024
21d8205
Update freecen_csv_entries_helper.rb
AnneV-Learn Aug 3, 2024
94fe018
Update freecen_csv_entries_helper.rb
AnneV-Learn Aug 4, 2024
e81b74d
Merge branch 'master' into fc_1785_86_87_93_av
AnneV-Learn Aug 7, 2024
58c7465
Merge branch 'master' into fc_1785_86_87_93_av
AnneV-Learn Aug 8, 2024
f2382e7
Merge pull request #2739 from jayto581/jc/250/review-links-in-footer
jayto581 Aug 13, 2024
db851af
Merge pull request #2738 from jayto581/jc/294/update-members-page-on-…
jayto581 Aug 13, 2024
c127c64
chore: update release notes
jayto581 Aug 13, 2024
2b89342
Merge pull request #2747 from jayto581/jc/release-notes-2024-08-13
jayto581 Aug 13, 2024
52f4810
test
Vino-S Aug 14, 2024
f97fc7b
Merge branch 'master' of https://github.com/FreeUKGen/MyopicVicar int…
Vino-S Aug 14, 2024
f59d0c3
Resolve first issue report 15/08 by GJ
AnneV-Learn Aug 15, 2024
16fe95b
Merge branch 'master' of https://github.com/FreeUKGen/MyopicVicar
AnneV-Learn Aug 31, 2024
d755c2e
Merge branch 'master' into fc_1785_86_87_93_av
AnneV-Learn Aug 31, 2024
b2cdf73
If record accepted and POB/Notes was propagated - propagate acceptanc…
AnneV-Learn Sep 2, 2024
57276ac
Don't offer propagation after an Accept where records have already be…
AnneV-Learn Sep 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
list-style-type: none;
}

&-item:nth-child(3) {
padding-bottom: 1.425rem;
}
// &-item:nth-child(3) {
// padding-bottom: 1.425rem;
// }
}

/* fug project section */
Expand All @@ -98,6 +98,7 @@

&-heading {
margin: 1rem 0 0.25rem;
color: #dedede;
}

&-nav.c-subfooter-1__fug-nav.c-subfooter-1__fug-nav {
Expand All @@ -123,6 +124,7 @@

&-heading {
margin: 0.25rem;
color: #dedede;
}

&-list {
Expand Down
101 changes: 68 additions & 33 deletions app/controllers/freecen_csv_entries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,35 @@ def accept
message = 'The entry was not correctly linked. Have your coordinator contact the web master'
redirect_back(fallback_location: new_manage_resource_path, notice: message) && return
end
@freecen_csv_entry.update_attributes(warning_messages: '', record_valid: 'true')

@freecen_csv_entry.remove_flags if @freecen_csv_entry.flag
pob_propagated, notes_propagated = @freecen_csv_entry.were_pob_notes_propagated(@freecen_csv_entry.warning_messages)
if pob_propagated || notes_propagated
session[:propagated_alternate] = @freecen_csv_entry.id
if pob_propagated && notes_propagated
@propagation_fields = 'Both'
elsif pob_propagated
@propagation_fields = 'Alternative'
else
@propagation_fields = 'Notes'
end
@propagation_scope = 'File'
get_user_info_from_userid
warnings_adjustment, success, _message = @freecen_csv_entry.propagate_pob(@propagation_fields, @propagation_scope, @user.userid)
unless success
flash[:notice] = 'There was a problem propagating the POB acceptance - please report to System Administrator'
redirect_to(freecen_csv_entry_path(@freecen_csv_entry)) && return
end
@freecen_csv_file = @freecen_csv_entry.freecen_csv_file
original_warning_count = @freecen_csv_file.total_warnings
@freecen_csv_file.adjust_total_warning_messages_and_lock(original_warning_count, warnings_adjustment)
end

@freecen_csv_entry.update_attributes(warning_messages: '', record_valid: 'true')
@freecen_csv_entry.remove_flags if @freecen_csv_entry.flag
@freecen_csv_file = @freecen_csv_entry.freecen_csv_file
@freecen_csv_file.update_total_warning_messages
session[:propagate_alternate] = @freecen_csv_entry.id unless verbatim_place_of_birth_matches_place_of_birth(@freecen_csv_entry)
session[:propagate_note] = @freecen_csv_entry.id if @freecen_csv_entry.notes.present?
flash[:notice] = 'The acceptance was successful'
redirect_to(freecen_csv_entry_path(@freecen_csv_entry)) && return
end
Expand All @@ -56,6 +81,7 @@ def revalidate
redirect_back(fallback_location: edit_freecen_csv_entry_path(@freecen_csv_entry), notice: "The revalidation of the entry failed #{@freecen_csv_entry.errors.full_messages}.") && return
else
@freecen_csv_entry.update_attributes(warning_messages: "Warning: Line #{@freecen_csv_entry.record_number}: Validator requested reprocessing", record_valid: 'false')
@freecen_csv_entry.reload
@freecen_csv_file = @freecen_csv_entry.freecen_csv_file
@freecen_csv_file.update_attributes(locked_by_transcriber: true)
flash[:notice] = 'The entry was declared false.'
Expand Down Expand Up @@ -155,7 +181,7 @@ def edit
@dwelling = Freecen::LOCATION_DWELLING
@counties = ChapmanCode.freecen_birth_codes
@counties.sort!
@freecen_csv_entry.record_valid = false
@freecen_csv_entry.record_valid = 'false'
get_user_info_from_userid
session.delete(:propagate_alternate)
session.delete(:propagate_note)
Expand Down Expand Up @@ -201,38 +227,36 @@ def new
@languages = FreecenValidations::VALID_LANGUAGE
end

def propagate_alternate
@freecen_csv_entry = FreecenCsvEntry.find(params[:id]) if params[:id].present?
unless FreecenCsvEntry.valid_freecen_csv_entry?(@freecen_csv_entry)
message = 'The entry was not correctly linked. Have your coordinator contact the web master'
redirect_back(fallback_location: new_manage_resource_path, notice: message) && return
end

success, message = @freecen_csv_entry.propagate_alternate
if success
flash[:notice] = 'The propagation of the alternate fields was was successful, the file is now locked against replacement until it has been downloaded.'
else
flash[:notice] = "The propagation of the alternate fields failed because #{message}."
end
session.delete(:propagate_alternate)
redirect_to freecen_csv_entry_path(@freecen_csv_entry)
end

def propagate_note
@freecen_csv_entry = FreecenCsvEntry.find(params[:id]) if params[:id].present?
unless FreecenCsvEntry.valid_freecen_csv_entry?(@freecen_csv_entry)
message = 'The entry was not correctly linked. Have your coordinator contact the web master'
redirect_back(fallback_location: new_manage_resource_path, notice: message) && return
end

success, message = @freecen_csv_entry.propagate_note
if success
flash[:notice] = 'The propagation of the note field was was successful, the file is now locked against replacement until it has been downloaded.'
def propagate_pob
if params[:commit] == 'Submit'
@freecen_csv_entry = FreecenCsvEntry.find(params[:id])
@propagation_fields = params[:propagatepob][:propagation_fields]
@propagation_scope = params[:propagatepob][:propagation_scope]
get_user_info_from_userid
warnings_adjustment, success, message = @freecen_csv_entry.propagate_pob(@propagation_fields, @propagation_scope, @user.userid)
if success
session[:propagated_alternate] = session[:propagate_alternate]
else
session.delete(:propagate_alternate)
end
@freecen_csv_entry.reload
@freecen_csv_file = @freecen_csv_entry.freecen_csv_file
original_warning_count = @freecen_csv_file.total_warnings
@freecen_csv_file.adjust_total_warning_messages_and_lock(original_warning_count, warnings_adjustment)
flash[:notice] = success ? 'Propagation processed successfully, the file is now locked against replacement until it has been downloaded.' : message
redirect_to freecen_csv_entry_path(@freecen_csv_entry)
else
flash[:notice] = "The propagation of the note field failed because #{message}."
@freecen_csv_entry = FreecenCsvEntry.find(params[:id]) if params[:id].present?
unless FreecenCsvEntry.valid_freecen_csv_entry?(@freecen_csv_entry)
message = 'The entry was not correctly linked. Have your coordinator contact the web master'
redirect_back(fallback_location: new_manage_resource_path, notice: message) && return
end
@propagation_fields = params[:propagation_fields]
@freecen_csv_file = @freecen_csv_entry.freecen_csv_file
@chapman_code = @freecen_csv_file.chapman_code
@scope = FreecenCsvEntry.propagation_scope(@freecen_csv_entry, @chapman_code)
end
session.delete(:propagate_note)
redirect_to freecen_csv_entry_path(@freecen_csv_entry)
redirect_to freecen_csv_entry_path(@freecen_csv_entry) && return
end

def show
Expand All @@ -253,6 +277,8 @@ def show
session[:current_list_entry] = @freecen_csv_entry.id if @next_list_entry.present? || @previous_list_entry.present?
session[:next_list_entry] = @next_list_entry.id if @next_list_entry.present?
session[:previous_list_entry] = @previous_list_entry.id if @previous_list_entry.present?
session[:propagate_alternate] = @freecen_csv_entry.id unless verbatim_place_of_birth_matches_place_of_birth(@freecen_csv_entry) || @freecen_csv_entry.record_valid.downcase == 'false'
session[:propagate_note] = @freecen_csv_entry.id unless @freecen_csv_entry.notes.blank? || verbatim_place_of_birth_matches_place_of_birth(@freecen_csv_entry) || @freecen_csv_entry.record_valid.downcase == 'false'
end

def update
Expand Down Expand Up @@ -302,6 +328,15 @@ def update_file_statistics(place)
@freecen_csv_file.save
end

def verbatim_place_of_birth_matches_place_of_birth(entry)

return true if entry.birth_county.blank? && entry.birth_place.blank?

return true if entry.verbatim_birth_county == entry.birth_county && entry.verbatim_birth_place == entry.birth_place

false
end

private

def freecen_csv_entry_params
Expand Down
2 changes: 2 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ def helpful_anchors
privacyNotice: 'Privacy Notice (pdf)',
termAndConditions: 'Terms and Conditions',
contactUs: 'Contact Us',
accessibility: 'Accessibility',
donation: 'Make a donation to cover our operating costs',
fugNews: 'News about Free UK Genealogy',
freeregIcon: '<span class="accessibility">FreeREG</span>',
Expand All @@ -772,6 +773,7 @@ def helpful_links
privacyNotice: 'https://drive.google.com/file/d/10r_c-5d9DDces-OUX7D4UJJKGNIhu8sV/view?usp=sharing',
termAndConditions: '/cms/terms-and-conditions',
contactUs: contact_us_path,
accessibility: 'https://www.freereg.org.uk/cms/about/accessibility-statement',
donation: 'https://www.freeukgenealogy.org.uk/help-us-keep-history-free',
fugNews: 'https://www.freeukgenealogy.org.uk/news/',
freereg: 'https://www.freereg.org.uk/',
Expand Down
46 changes: 32 additions & 14 deletions app/helpers/freecen_csv_entries_helper.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
module FreecenCsvEntriesHelper

def previous_list_entry
previous_list_entry = FreecenCsvEntry.find_by(id: session[:previous_list_entry])
link_to "Previous #{Freecen::Listings::NAMES[session[:cen_index_type]]} entry", freecen_csv_entry_path(previous_list_entry), method: :get, class: "btn btn--small",
title: "Show the previous entry in the #{Freecen::Listings::NAMES[session[:cen_index_type]]} List" if previous_list_entry.present? && session[:cen_index_type] != 'Ind'
unless @freecen_csv_entry.id == session[:previous_list_entry]
previous_list_entry = FreecenCsvEntry.find_by(id: session[:previous_list_entry])
link_to "Previous #{Freecen::Listings::NAMES[session[:cen_index_type]]} entry", freecen_csv_entry_path(previous_list_entry), method: :get, class: "btn btn--small",
title: "Show the previous entry in the #{Freecen::Listings::NAMES[session[:cen_index_type]]} List" if previous_list_entry.present? && session[:cen_index_type] != 'Ind'
end
end

def next_list_entry
next_list_entry = FreecenCsvEntry.find_by(id: session[:next_list_entry])
link_to "Next #{Freecen::Listings::NAMES[session[:cen_index_type]]} entry", freecen_csv_entry_path(next_list_entry), method: :get, class: "btn btn--small",
title: "Show the next in the #{Freecen::Listings::NAMES[session[:cen_index_type]]} List" if next_list_entry.present? && session[:cen_index_type] != 'Ind'
unless @freecen_csv_entry.id == session[:next_list_entry]
next_list_entry = FreecenCsvEntry.find_by(id: session[:next_list_entry])
link_to "Next #{Freecen::Listings::NAMES[session[:cen_index_type]]} entry", freecen_csv_entry_path(next_list_entry), method: :get, class: "btn btn--small",
title: "Show the next in the #{Freecen::Listings::NAMES[session[:cen_index_type]]} List" if next_list_entry.present? && session[:cen_index_type] != 'Ind'
end
end

def current_list_entry
Expand Down Expand Up @@ -46,18 +50,32 @@ def accept_entry
end

def propagate_alternate
if session[:propagate_alternate].present? && session[:propagate_alternate] == @freecen_csv_entry.id && @year != '1841'
link_to 'Propagate Alternate Fields', propagate_alternate_freecen_csv_entry_path(@freecen_csv_entry), method: :get, class: "btn btn--small",
title: 'Propagates the alternate fields to entries with the same verbatim POB fields as this entry',
data: { confirm: 'Are you sure you want to propagate this entry' }
return if session[:propagate_alternate] == session[:propagated_alternate]

if session[:propagate_alternate].present? && session[:propagate_alternate] == @freecen_csv_entry.id && @year != '1841' && @freecen_csv_entry.record_valid.downcase == 'true'
link_to 'Propagate Alternate POB Fields', propagate_pob_freecen_csv_entry_path(id: @freecen_csv_entry._id, propagation_fields: 'Alternative'), method: :get, class: "btn btn--small",
title: 'Allows you to specify the scope of Propagation the alternative POB fields',
data: { confirm: 'Are you sure you want to Propagate the Alternate POB of this entry' }
end
end

def propagate_note
if session[:propagate_note].present? && session[:propagate_note] == @freecen_csv_entry.id
link_to 'Propagate Note Field', propagate_note_freecen_csv_entry_path(@freecen_csv_entry), method: :get, class: "btn btn--small",
title: 'Propagates the note field to entries with the same verbatim POB fields as this entry',
data: { confirm: 'Are you sure you want to propagate this entry' }
return if session[:propagate_alternate] == session[:propagated_alternate]

if session[:propagate_note].present? && session[:propagate_note] == @freecen_csv_entry.id && @freecen_csv_entry.record_valid.downcase == 'true'
link_to 'Propagate Notes Field', propagate_pob_freecen_csv_entry_path(id: @freecen_csv_entry._id, propagation_fields: 'Notes'), method: :get, class: "btn btn--small",
title: 'Allows you to specify the scope of Propagation the Notes fields',
data: { confirm: 'Are you sure you want to Propagate the Notes of this entry' }
end
end

def propagate_both
return if session[:propagate_alternate] == session[:propagated_alternate]

if session[:propagate_alternate].present? && session[:propagate_note].present? && session[:propagate_alternate] == @freecen_csv_entry.id && @year != '1841' && @freecen_csv_entry.record_valid.downcase == 'true'
link_to 'Propagate POB and Notes Field', propagate_pob_freecen_csv_entry_path(id: @freecen_csv_entry._id, propagation_fields: 'Both'), method: :get, class: "btn btn--small",
title: 'Allows you to specify the scope of Propagation the alternative POB and Notes fields',
data: { confirm: 'Are you sure you want to Propagate the Alternate POB and Notes of this entry' }
end
end

Expand Down
Loading