Skip to content

Commit

Permalink
Merge pull request #2311 from UKGovernmentBEIS/3005-new-dsit-org-id
Browse files Browse the repository at this point in the history
(3005) Change DSIT organisations' IATI references and names
  • Loading branch information
CristinaRO committed Jan 19, 2024
2 parents 49e892f + fed1498 commit 8ba7b20
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Exclude health check requests from host authorisation
- Remove the feature flag for ODA bulk upload
- Change the transparency identifier and names for the DSIT organisations (DSIT and DSIT Finance)

## Release 142 - 2024-01-16

Expand Down
2 changes: 1 addition & 1 deletion app/models/organisation.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Organisation < ApplicationRecord
SERVICE_OWNER_IATI_REFERENCE = "GB-GOV-13"
SERVICE_OWNER_IATI_REFERENCE = "GB-GOV-26"

strip_attributes only: [:iati_reference]
has_many :users
Expand Down
2 changes: 1 addition & 1 deletion config/locales/models/actual.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ en:
description: For example, 2020 quarter one spend on the Early Career Research Network project.
disbursement_channel: The channel through which the funds will flow for this actual.
providing_organisation: The organisation where this actual is coming from.
providing_organisation_reference_html: For example, GB-GOV-13. To lookup codes or for more information see <a href="http://org-id.guide/" target="_blank" class="govuk-link">the organisation finder service (Opens in new window)</a>.
providing_organisation_reference_html: For example, GB-GOV-26. To lookup codes or for more information see <a href="http://org-id.guide/" target="_blank" class="govuk-link">the organisation finder service (Opens in new window)</a>.
receiving_organisation: The organisation receiving the money from this actual spend.
receiving_organisation_reference_html: For example, GB-COH-12345. To lookup codes or for more information see <a href="http://org-id.guide/" target="_blank" class="govuk-link">the organisation finder service (Opens in new window)</a>.
table:
Expand Down
2 changes: 1 addition & 1 deletion config/locales/models/organisation.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ en:
organisation:
attributes:
iati_reference:
format: Identifiers must start with a country code and company type separated by a dash, eg. GB-GOV-13
format: Identifiers must start with a country code and company type separated by a dash, eg. GB-GOV-26
blank: Enter an IATI reference
default_currency:
blank: Enter a default currency
Expand Down
49 changes: 49 additions & 0 deletions db/migrate/20240111133813_change_beis_to_dsit.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
class ChangeBeisToDsit < ActiveRecord::Migration[6.1]
def up
service_owner = Organisation.where(iati_reference: "GB-GOV-13").first
if service_owner
service_owner.iati_reference = "GB-GOV-26"
service_owner.name = "DEPARTMENT FOR SCIENCE, INNOVATION AND TECHNOLOGY"
service_owner.beis_organisation_reference = "DSIT"

unless service_owner.save
Rails.logger.error("Failed to save the changes to #{service_owner.name}: #{service_owner.errors.messages.inspect}")
end
end

finance = Organisation.where(iati_reference: "GB-GOV-13-OPERATIONS").first
if finance
finance.iati_reference = "GB-GOV-26-OPERATIONS"
finance.name = "DSIT FINANCE"
finance.beis_organisation_reference = "DF"

unless finance.save
Rails.logger.error("Failed to save the changes to #{finance.name}: #{finance.errors.messages.inspect}")
end
end
end

def down
service_owner = Organisation.where(iati_reference: "GB-GOV-26").first
if service_owner
service_owner.iati_reference = "GB-GOV-13"
service_owner.name = "DEPARTMENT FOR BUSINESS, ENERGY & INDUSTRIAL STRATEGY"
service_owner.beis_organisation_reference = "BEIS"

unless service_owner.save
Rails.logger.error("Failed to save the changes to #{service_owner.name}: #{service_owner.errors.messages.inspect}")
end
end

finance = Organisation.where(iati_reference: "GB-GOV-26-OPERATIONS").first
if finance
finance.iati_reference = "GB-GOV-13-OPERATIONS"
finance.name = "BEIS FINANCE"
finance.beis_organisation_reference = "BF"

unless finance.save
Rails.logger.error("Failed to save the changes to #{finance.name}: #{finance.errors.messages.inspect}")
end
end
end
end
2 changes: 1 addition & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2023_11_07_141900) do
ActiveRecord::Schema.define(version: 2024_01_11_133813) do

# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
Expand Down
2 changes: 1 addition & 1 deletion db/seeds/organisations.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- name: Department for Business, Energy and Industrial Strategy
short_name: BEIS
reference: GB-GOV-13
reference: GB-GOV-26
type: 10
role: service_owner
- name: UK Space Agency
Expand Down
2 changes: 1 addition & 1 deletion doc/activity-identifiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ end users.
This identifier is a transformed version of the RODA Identifier that's
compatible with the IATI rules. Any string of characters in the RODA Identifier
that are not letters, digits, or `-` are replaced with `-`, and the
organisational prefix `GB-GOV-13-` is prepended to the result.
organisational prefix `GB-GOV-26-` is prepended to the result.

This identifier is not set by the ingest process _or_ assigned directly by end
users; it is derived from the RODA Identifier when that is set.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
expect(created_activity.oda_eligibility).to eq(activity.oda_eligibility)

expect(created_activity.accountable_organisation_name).to eq("Department for Business, Energy and Industrial Strategy")
expect(created_activity.accountable_organisation_reference).to eq("GB-GOV-13")
expect(created_activity.accountable_organisation_reference).to eq("GB-GOV-26")
expect(created_activity.accountable_organisation_type).to eq("10")

expect(created_activity.transparency_identifier).to eql("GB-GOV-13-#{created_activity.roda_identifier}")
expect(created_activity.transparency_identifier).to eql("GB-GOV-26-#{created_activity.roda_identifier}")

expect_implementing_organisation_to_be_the_partner_organisation(
activity: created_activity,
Expand Down Expand Up @@ -116,10 +116,10 @@
expect(created_activity.oda_eligibility).to eq(activity.oda_eligibility)

expect(created_activity.accountable_organisation_name).to eq("Department for Business, Energy and Industrial Strategy")
expect(created_activity.accountable_organisation_reference).to eq("GB-GOV-13")
expect(created_activity.accountable_organisation_reference).to eq("GB-GOV-26")
expect(created_activity.accountable_organisation_type).to eq("10")

expect(created_activity.transparency_identifier).to eql("GB-GOV-13-#{created_activity.roda_identifier}")
expect(created_activity.transparency_identifier).to eql("GB-GOV-26-#{created_activity.roda_identifier}")
expect(created_activity.commitment.value).to eq(activity.commitment.value)

expect(created_activity.publish_to_iati).to be(true)
Expand Down Expand Up @@ -167,10 +167,10 @@
expect(created_activity.oda_eligibility).to eq(activity.oda_eligibility)

expect(created_activity.accountable_organisation_name).to eq("Department for Business, Energy and Industrial Strategy")
expect(created_activity.accountable_organisation_reference).to eq("GB-GOV-13")
expect(created_activity.accountable_organisation_reference).to eq("GB-GOV-26")
expect(created_activity.accountable_organisation_type).to eq("10")

expect(created_activity.transparency_identifier).to eql("GB-GOV-13-#{created_activity.roda_identifier}")
expect(created_activity.transparency_identifier).to eql("GB-GOV-26-#{created_activity.roda_identifier}")
expect(created_activity.commitment.value).to eq(activity.commitment.value)

expect(created_activity.publish_to_iati).to be(true)
Expand Down
2 changes: 1 addition & 1 deletion spec/models/organisation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

describe "#iati_reference" do
it "returns true if it does matches a known structure XX-XXX-" do
organisation = build(:partner_organisation, iati_reference: "GB-GOV-13")
organisation = build(:partner_organisation, iati_reference: "GB-GOV-44")
result = organisation.valid?
expect(result).to be(true)
end
Expand Down

0 comments on commit 8ba7b20

Please sign in to comment.