Skip to content

Commit

Permalink
Merge pull request #2934 from bitzesty/palace-invite-csv-refactor
Browse files Browse the repository at this point in the history
Update the ‘Reception Buckingham Palace’ CSV export with new fields following palace form changes and re-order to match the palace spreadsheet
  • Loading branch information
dreamfall authored May 20, 2024
2 parents 70eebf3 + 96dc517 commit 015b90e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 21 deletions.
8 changes: 8 additions & 0 deletions app/models/reports/palace_attendee_pointer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,12 @@ def royal_family_connection_details
def previous_years_won
form_answer_pointer.send(:current_queens_award_holder)
end

def disabled_access
bool(palace_attendee.disabled_access)
end

def bool(var)
var ? "Yes" : "No"
end
end
43 changes: 25 additions & 18 deletions app/models/reports/reception_buckingham_palace_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@ class Reports::ReceptionBuckinghamPalaceReport
include Reports::CsvHelper

MAPPING = [
{
label: "Award / Category",
method: :award_category,
},
{
label: "Organisation / Company (NOT included on envelope)",
method: :organisation_company,
},
{
label: "Job Title / Position",
method: :job_name,
},
{
label: "Award / Category",
method: :award_category,
},
{
label: "Title",
method: :title,
Expand All @@ -22,10 +26,6 @@ class Reports::ReceptionBuckinghamPalaceReport
label: "Surname",
method: :last_name,
},
{
label: "Job Title / Position",
method: :job_name,
},
{
label: "Decorations / Post Nominals",
method: :post_nominals,
Expand All @@ -39,38 +39,45 @@ class Reports::ReceptionBuckinghamPalaceReport
method: :address_2,
},
{
label: "Address 3",
label: "City or town",
method: :address_3,
},
{
label: "Address 4",
label: "County",
method: :address_4,
},
{
label: "Postcode",
method: :postcode,
},
{
label: "Telephone number (if known)",
method: :phone_number,
label: "Dietary needs",
method: :dietary_requirements,
},
{
label: "Product or brief description",
method: :product_description,
label: "Disabled access required",
method: :disabled_access,
},
{
label: "Additional Information, for example, Wheelchair user",
label: "Accessibility details (for example, wheelchair user or person hard of hearing)",
method: :additional_info,
},
{
label: "Previous years won",
method: :previous_years_won,
label: "Telephone number (if known)",
method: :phone_number,
},
{
label: "Royal Affiliation / Previous Links",
method: :royal_family_connection_details,
},

{
label: "Product or brief description",
method: :product_description,
},
{
label: "Previous years won",
method: :previous_years_won,
},
]

def initialize(year)
Expand Down
2 changes: 1 addition & 1 deletion app/views/admin/dashboard/downloads/_csv_reports.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ul.download-list

li.download-item
p.download-item__title
' Reception Buckingham Palace
' Royal Reception guest list
/ p.download-item__description
' Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@

it "produces proper output" do
expect(output.size).to eq(2)
expect(output[1][2]).to eq(title)
expect(output[1][3]).to eq(first_name)
expect(output[1][3]).to eq(title)
expect(output[1][4]).to eq(first_name)
end
end
end

0 comments on commit 015b90e

Please sign in to comment.