Skip to content

Commit

Permalink
Add LAESTAB/DfE Number to new academy details
Browse files Browse the repository at this point in the history
This request came in the 'front door' from a service support user. We
already have the value as `dfe_number` to keep things as clear as we can
I've made an alias of that method and labelled the value with both
'LAESTAB' and 'DfE number'.
  • Loading branch information
mec committed Oct 3, 2024
1 parent d19223d commit dbc184e
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased][unreleased]

### Added

- The LAESTAB, also known as the DfE number is now shown on the new academy
details once available.

### Fixed

- Do not show deleted projects in the "Added by you" page
Expand Down
3 changes: 3 additions & 0 deletions app/models/gias/establishment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ def local_authority
end

def dfe_number
return unless local_authority_code.present? && establishment_number.present?

"#{local_authority_code}/#{establishment_number}"
end
alias_method :laestab, :dfe_number

def has_diocese?
diocese_code != DIOCESE_NOT_APPLICABLE_CODE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
row.with_key { t("project_information.show.academy_details.rows.urn") }
row.with_value { project.academy.urn.to_s }
end
summary_list.with_row do |row|
row.with_key { t("project_information.show.academy_details.rows.laestab") }
row.with_value { project.academy.laestab }
end
summary_list.with_row do |row|
row.with_key { t("project_information.show.academy_details.rows.school_type") }
row.with_value { project.academy.type }
Expand Down
1 change: 1 addition & 0 deletions config/locales/project_information.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ en:
it can take one day for the data to be syncronised
rows:
urn: Academy URN (unique reference number)
laestab: LAESTAB (DfE number)
academy_name: Name
address: Address
school_type: Type
Expand Down
12 changes: 12 additions & 0 deletions spec/models/gias/establishment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@
establishment = build(:gias_establishment, urn: 123456, local_authority_code: 123, establishment_number: 456)
expect(establishment.dfe_number).to eq("123/456")
end

it "returns nil when the codes are missing" do
establishment = build(:gias_establishment, urn: 123456, local_authority_code: nil, establishment_number: nil)
expect(establishment.dfe_number).to be_nil
end
end

describe "laestab" do
it "returns the local authority code and establishment number, formatted as a dfe_number" do
establishment = build(:gias_establishment, urn: 123456, local_authority_code: 123, establishment_number: 456)
expect(establishment.laestab).to eq("123/456")
end
end

describe "local_authority" do
Expand Down

0 comments on commit dbc184e

Please sign in to comment.