Skip to content

Commit 548996b

Browse files
authored
Add organisations:add_programme (#3112)
This adds a Rake task that can be used to add a programme to an existing organisation.
2 parents 427ea8f + cc2a918 commit 548996b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

docs/rake-tasks.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ This creates a new clinic location and attaches it to a organisation.
3131

3232
Creates a GP practice location suitable for smoke testing in production.
3333

34+
## Organisations
35+
36+
### `organisations:add_programme[ods_code,type]`
37+
38+
- `ods_code` - The ODS code of the organisation.
39+
- `type` - The programme type to add to the organisation. (`hpv`, `menacwy`, `td_ipv`)
40+
41+
This adds a programme to an existing organisation. Normally this would be handled by the onboarding process.
42+
3443
## Schools
3544

3645
### `schools:add_to_organisation[ods_code,team_name,urn,...]`

lib/tasks/organisations.rake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
3+
namespace :organisations do
4+
desc "Add a programme to an organisation."
5+
task :add_programme, %i[ods_code type] => :environment do |_task, args|
6+
organisation = Organisation.find_by!(ods_code: args[:ods_code])
7+
programme = Programme.find_by!(type: args[:type])
8+
9+
OrganisationProgramme.find_or_create_by!(organisation:, programme:)
10+
end
11+
end

0 commit comments

Comments
 (0)