Skip to content

Commit 08d36c5

Browse files
Update safeguarding flag call to match api changes (#400)
closes #399 --------- Co-authored-by: create-issue-branch[bot] <53036503+create-issue-branch[bot]@users.noreply.github.com> Co-authored-by: Dan Halson <[email protected]>
1 parent 34a5c63 commit 08d36c5

17 files changed

+57
-49
lines changed

.devcontainer/docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ services:
33
build:
44
context: .
55
target: dev-container
6-
command: bash bin/dev-container-entrypoint.sh
6+
command: bash bin/docker-debug-entrypoint.sh
77
volumes:
88
# - ${HOME}/.bashrc:/root/.bashrc:ro # Map a ~/.bashrc in your home directory for customising bash
99
- ${HOME}/.ssh:/root/.ssh:ro # To share any ssh keys with the container
@@ -12,4 +12,3 @@ services:
1212

1313
volumes:
1414
node_modules: null
15-

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@
3939
/coverage
4040

4141
.byebug_history
42+
43+
docker-compose.override.yml

.vscode/launch.json

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,22 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
52
"version": "0.2.0",
63
"configurations": [
74
{
85
"type": "ruby_lsp",
6+
"name": "Debug",
97
"request": "launch",
10-
"name": "Debug program",
11-
"program": "ruby "
8+
"program": "ruby ${file}",
129
},
1310
{
14-
"type": "rdbg",
15-
"name": "Debug current file with rdbg",
11+
"type": "ruby_lsp",
1612
"request": "launch",
17-
"script": "${file}",
18-
"args": [],
19-
"askParameters": true
13+
"name": "Debug test file",
14+
"program": "ruby -Itest ${relativeFile}",
2015
},
2116
{
22-
"type": "rdbg",
23-
"name": "Attach with rdbg",
24-
"request": "attach"
25-
}
26-
]
17+
"type": "ruby_lsp",
18+
"request": "attach",
19+
"name": "Attach to existing server",
20+
},
21+
],
2722
}

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ gem 'sentry-rails'
3838

3939
group :development, :test do
4040
gem 'bullet'
41+
gem 'debug'
4142
gem 'dotenv-rails'
4243
gem 'factory_bot_rails'
4344
gem 'faker'

Gemfile.lock

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ GEM
148148
database_cleaner-core (~> 2.0.0)
149149
database_cleaner-core (2.0.1)
150150
date (3.3.4)
151+
debug (1.9.2)
152+
irb (~> 1.10)
153+
reline (>= 0.3.8)
151154
diff-lcs (1.5.0)
152155
docile (1.4.0)
153156
dotenv (2.8.1)
@@ -515,6 +518,7 @@ DEPENDENCIES
515518
climate_control
516519
countries
517520
database_cleaner-active_record
521+
debug
518522
dotenv-rails
519523
email_validator
520524
factory_bot_rails

app/controllers/api/school_students_controller.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def create_teacher_safeguarding_flag
7676

7777
ProfileApiClient.create_safeguarding_flag(
7878
token: current_user.token,
79-
flag: ProfileApiClient::SAFEGUARDING_FLAGS[:teacher]
79+
flag: ProfileApiClient::SAFEGUARDING_FLAGS[:teacher],
80+
email: current_user.email
8081
)
8182
end
8283

@@ -85,7 +86,8 @@ def create_owner_safeguarding_flag
8586

8687
ProfileApiClient.create_safeguarding_flag(
8788
token: current_user.token,
88-
flag: ProfileApiClient::SAFEGUARDING_FLAGS[:owner]
89+
flag: ProfileApiClient::SAFEGUARDING_FLAGS[:owner],
90+
email: current_user.email
8991
)
9092
end
9193
end

bin/dev-container-entrypoint.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

bin/docker-debug-entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
rails db:prepare --trace
2+
rdbg -n -o -c -- bin/rails s -p 3009 -b '0.0.0.0'

db/seeds.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
if Rails.env.development?
66
Rake::Task['projects:create_all'].invoke
7-
Rake::Task['classroom_management:seed_a_school_with_lessons'].invoke
7+
Rake::Task['classroom_management:seed_a_school_with_lessons_and_students'].invoke
88
end

lib/profile_api_client.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,9 @@ def safeguarding_flags(token:)
153153
response.body.map { |flag| SafeguardingFlag.new(**flag.symbolize_keys) }
154154
end
155155

156-
def create_safeguarding_flag(token:, flag:)
156+
def create_safeguarding_flag(token:, flag:, email:)
157157
response = connection(token).post('/api/v1/safeguarding-flags') do |request|
158-
request.body = { flag: }
158+
request.body = { flag:, email: }
159159
end
160160

161161
raise UnexpectedResponse, response unless [201, 303].include?(response.status)

0 commit comments

Comments
 (0)