Skip to content

Commit f723294

Browse files
Merge branch 'staging' of github.com:code-dot-org/code-dot-org into test
2 parents e25c5e5 + 2701d53 commit f723294

File tree

6 files changed

+47
-16
lines changed

6 files changed

+47
-16
lines changed

dashboard/app/controllers/reports_controller.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ class ReportsController < ApplicationController
1010
before_action :set_script
1111
include LevelSourceHintsHelper
1212

13+
before_action except: [:user_stats, :header_stats, :students, :prizes, :assume_identity, :assume_identity_form] do
14+
render status: :forbidden, text: "Disabled during HOC because it's too slow"
15+
return false
16+
end
17+
1318
def user_stats
1419
@user = User.find(params[:user_id])
1520
authorize! :read, @user

dashboard/test/controllers/reports_controller_test.rb

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ class ReportsControllerTest < ActionController::TestCase
152152

153153
test "should get usage" do
154154
get :usage, :user_id => @not_admin.id
155-
assert_response :success
155+
assert_response :forbidden # disabled for hoc
156+
#assert_response :success
156157
end
157158

158159
test "should not get usage if not signed in" do
@@ -166,17 +167,18 @@ class ReportsControllerTest < ActionController::TestCase
166167
sign_in @not_admin
167168

168169
get :usage, :user_id => @not_admin.id
169-
170-
assert_response :success
170+
assert_response :forbidden # disabled for hoc
171+
#assert_response :success
171172
end
172173

173174

174175
test "should get usage for students if teacher" do
175176
sign_in @teacher
176177

177178
get :usage, :user_id => @student.id
179+
assert_response :forbidden # disabled for hoc
178180

179-
assert_response :success
181+
#assert_response :success
180182
end
181183

182184
test "should not get usage for other users if not admin or teacher" do
@@ -216,11 +218,30 @@ class ReportsControllerTest < ActionController::TestCase
216218
assert_redirected_to_sign_in
217219
end
218220

219-
generate_admin_only_tests_for :all_usage
221+
def self.generate_admin_forbidden_tests_for(action, params = {})
222+
test "should get #{action}" do
223+
get action, params
224+
assert_response :forbidden
225+
end
220226

221-
generate_admin_only_tests_for :admin_stats
227+
test "should not get #{action} if not signed in" do
228+
sign_out @admin
229+
get action, params
230+
assert_redirected_to_sign_in
231+
end
222232

223-
generate_admin_only_tests_for :admin_gallery
233+
test "should not get #{action} if not admin" do
234+
sign_in @not_admin
235+
get action, params
236+
assert_response :forbidden
237+
end
238+
end
239+
240+
generate_admin_forbidden_tests_for :all_usage # disabled for hoc
241+
242+
generate_admin_forbidden_tests_for :admin_stats # disabled for hoc
243+
244+
generate_admin_forbidden_tests_for :admin_gallery # disabled for hoc
224245

225246
test "admin_gallery shows most recent 25 gallery items" do
226247
sign_in @admin
@@ -230,8 +251,9 @@ class ReportsControllerTest < ActionController::TestCase
230251
end
231252

232253
get :admin_gallery
254+
assert_response :forbidden # disabled for hoc
233255

234-
assert_equal 25, assigns(:gallery_activities).count
256+
# assert_equal 25, assigns(:gallery_activities).count
235257
end
236258

237259
test "students should redirect to new teacher dashboard" do
@@ -241,7 +263,9 @@ class ReportsControllerTest < ActionController::TestCase
241263

242264
test "should get level_stats" do
243265
get :level_stats, {:level_id => create(:level).id}
244-
assert_response :success
266+
267+
assert_response :forbidden # disabled for hoc
268+
# assert_response :success
245269
end
246270

247271
test "should not get level_stats if not admin" do
@@ -325,7 +349,8 @@ class ReportsControllerTest < ActionController::TestCase
325349

326350
test 'should get admin progress' do
327351
get :admin_progress
328-
assert_select 'h1', 'Admin progress'
352+
assert_response :forbidden # disabled for hoc
353+
# assert_select 'h1', 'Admin progress'
329354
end
330355

331356
end

pegasus/data/cdo-partners.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ ZenDesk,https://www.zendesk.com/,infrastructure,TRUE,FALSE,TRUE,
136136
Actua,http://www.actua.ca/,international,TRUE,TRUE,TRUE,
137137
Adfaber,http://adfaber.org/,international,TRUE,TRUE,TRUE,
138138
Almooc,http://almooc.com/,international,TRUE,TRUE,TRUE,
139+
Bebras Challenge,http://www.bebraschallenge.org/,international,TRUE,TRUE,TRUE,
139140
Cini,http://www.consorzio-cini.it/,international,TRUE,TRUE,TRUE,
140141
Code Club Aotearoa,http://www.codeclub.org.nz/,international,TRUE,TRUE,TRUE,
141142
Fundacion Sadosky,http://www.fundacionsadosky.org.ar/,international,TRUE,TRUE,TRUE,
@@ -184,7 +185,7 @@ PopCap,http://www.popcap.com/,majoruk,TRUE,FALSE,TRUE,
184185
Rovio,http://www.rovio.com,majoruk,TRUE,FALSE,TRUE,
185186
Salesforce,http://salesforce.com,majoruk,TRUE,FALSE,TRUE,
186187
Code Club Aotearoa,http://www.codeclub.org.nz/,nz,FALSE,FALSE,TRUE,
187-
CPIT,http://www.cpit.ac.nz/,nz,FALSE,FALSE,TRUE,
188+
CPIT,http://www.cpit.ac.nz/news-and-events/news/cpit-supports-hour-of-code?utm_source=Homepage&utm_medium=Banner&utm_campaign=ICT%20-%20Hour%20of%20Code#,nz,FALSE,FALSE,TRUE,
188189
Google,http://www.google.com/,nz,FALSE,FALSE,TRUE,
189190
Akamai,http://www.akamai.com,other,FALSE,TRUE,FALSE,
190191
AngelHack,http://www.angelhack.com/,other,FALSE,TRUE,FALSE,

pegasus/sites.v3/code.org/public/educate/csp/aboutTheWidgets.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ They have been created primarily as tools to explore computer science concepts.
1212

1313
The widgets currently reside on Baker Franke's Cloud9 account for development, but will eventually be moved under the Code.org domain on Code.org's servers.
1414

15-
All<span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/InteractiveResource" property="dct:title" rel="dct:type">Code.org CSP Widgets</span> by <span xmlns:cc="http://creativecommons.org/ns#" property="cc:attributionName">Baker Franke</span> are licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.<br>
15+
All <span xmlns:dct="http://purl.org/dc/terms/" href="http://purl.org/dc/dcmitype/InteractiveResource" property="dct:title" rel="dct:type">Code.org CSP Widgets</span> by <span xmlns:cc="http://creativecommons.org/ns#" property="cc:attributionName">Baker Franke</span> are licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License</a>.<br>
1616
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a>
1717

1818

@@ -29,11 +29,11 @@ Many of the widgets employed in this curriculum were originally developed at the
2929

3030
3. In the case of the ***Sending Bits Widgets***...
3131

32-
* Students are *actually* posting data to a remote database (Parse.com) the content of which is not montitored, and they and can more or less post any text they like. Use with caution if you school has policies about such things.
33-
* At the moment there is a limit on the number of database requests-per-second that the widget can handle. If you or your students do things to push that limit you won't break anything (permenantly), but data will just stop flowing and you'll end up with a lot of confused students. It is most likely that a single classroom would hit the limit during **lesson 4** the first time you use the widget.
34-
* Somewhat counter-intuitively the limits on the widget are not related to the amount of data posted or retrived, but the number of times students click "send" or "recv".
32+
3. Students are *actually* posting data to a remote database (Parse.com) the content of which is not montitored, and they and can more or less post any text they like. Use with caution if you school has policies about such things.
33+
3. At the moment there is a limit on the number of database requests-per-second that the widget can handle. If you or your students do things to push that limit you won't break anything (permenantly), but data will just stop flowing and you'll end up with a lot of confused students. It is most likely that a single classroom would hit the limit during **lesson 4** the first time you use the widget.
34+
3. Somewhat counter-intuitively the limits on the widget are not related to the amount of data posted or retrived, but the number of times students click "send" or "recv".
3535

36-
4. If you have questions about usage or would like to give feed back please do so in the [CSP Forum](https://support.code.org/hc/communities/public/topics/200138206-CS-Principles)
36+
4. If you have questions about usage or would like to give feedback please do so in the [CSP Forum](https://support.code.org/hc/communities/public/topics/200138206-CS-Principles)
3737

3838
Thanks all,
3939

Loading
Loading

0 commit comments

Comments
 (0)