Skip to content

Commit

Permalink
Merge pull request #22969 from code-dot-org/staging
Browse files Browse the repository at this point in the history
DTT (Staging > Test) [robo-dtt]
  • Loading branch information
deploy-code-org committed Jun 7, 2018
2 parents fc61073 + d01db16 commit c512218
Show file tree
Hide file tree
Showing 7 changed files with 692 additions and 2 deletions.
8 changes: 8 additions & 0 deletions bin/i18n/sync-codeorg-in.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def localize_level_content
level_authored_hints = Hash.new
level_callouts = Hash.new
level_block_categories = Hash.new
level_function_names = Hash.new

Dir.glob("dashboard/config/scripts/levels/*.level").sort.each do |file|
level_name = File.basename(file, ".*")
Expand Down Expand Up @@ -93,6 +94,12 @@ def localize_level_content
name = category.attr('name')
level_block_categories[name] = name if name
end

## Function Names
blocks.xpath('//../block[@type="procedures_defnoreturn"]').each do |function|
name = function.at_xpath('./title[@name="NAME"]')
level_function_names[name.content] = name.content if name
end
end
end
end
Expand All @@ -103,6 +110,7 @@ def localize_level_content
copy_to_yml("authored_hints", level_authored_hints)
copy_to_yml("callouts", level_callouts)
copy_to_yml("block_categories", level_block_categories)
copy_to_yml("function_names", level_function_names)
end

sync_in if __FILE__ == $0
4 changes: 2 additions & 2 deletions dashboard/app/controllers/sections_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def update

# TODO: (madelynkasula) refactor to use strong params
fields = {}
fields[:course_id] = course_id
fields[:script_id] = script_id
fields[:course_id] = course_id if Course.valid_course_id?(course_id)
fields[:script_id] = script_id if Script.valid_script_id?(current_user, script_id)
fields[:name] = params[:name] unless params[:name].nil_or_empty?
fields[:login_type] = params[:login_type] if Section.valid_login_type?(params[:login_type])
fields[:grade] = params[:grade] if Section.valid_grade?(params[:grade])
Expand Down
296 changes: 296 additions & 0 deletions dashboard/config/locales/function_names.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,296 @@
---
en:
data:
function_names:
x: x
details: details
draw eyebrow: draw eyebrow
draw pupil: draw pupil
draw a circle: draw a circle
draw a car: draw a car
draw_rect: draw_rect
draw square: draw square
jump to controller top left: jump to controller top left
jump to middle: jump to middle
draw a button: draw a button
draw cord: draw cord
draw R pad: draw R pad
draw left leg: draw left leg
draw right leg: draw right leg
draw body and arms: draw body and arms
draw a head: draw a head
draw sitting stick figure: draw sitting stick figure
draw head: draw head
draw arms: draw arms
jump to neck: jump to neck
draw O: draw O
draw D: draw D
draw E: draw E
draw ear stems: draw ear stems
big gear: big gear
small gear: small gear
draw a hexagon: draw a hexagon
draw a flower: draw a flower
draw a square: draw a square
draw a snowflake: draw a snowflake
draw 3 hexagons: draw 3 hexagons
draw 4 hexagons: draw 4 hexagons
draw 5 hexagons: draw 5 hexagons
get 2 nectar: get 2 nectar
collect purple nectar: collect purple nectar
get 5: get 5
move and get nectar: move and get nectar
move and get 4: move and get 4
get 7 nectar make 7 honey: get 7 nectar make 7 honey
get 7 make 7: get 7 make 7
get 7: get 7
move and get 3: move and get 3
draw a tree: draw a tree
draw triangle: draw triangle
draw circle: draw circle
draw goal: draw goal
graph: graph
draw waves: draw waves
draw a wave: draw a wave
draw a small triangle: draw a small triangle
draw a medium triangle: draw a medium triangle
draw a large triangle: draw a large triangle
draw a big triangle: draw a big triangle
draw a triangle: draw a triangle
draw a house: draw a house
check purple flower: check purple flower
check flower make honey: check flower make honey
get nectar or make honey: get nectar or make honey
make 3 honey: make 3 honey
get 5 nectar: get 5 nectar
make all honey: make all honey
draw a star: draw a star
game has been won: game has been won
draw: draw
draw bit: draw bit
draw a polygon: draw a polygon
draw a shape: draw a shape
get 2 and make 2: get 2 and make 2
draw a pinwheel: draw a pinwheel
drawTree: drawTree
drawHouse: drawHouse
drawBranch: drawBranch
drawSky: drawSky
fillScreen: fillScreen
drawHouseLayer: drawHouseLayer
swap: swap
dropR: dropR
grabL: grabL
dropL: dropL
init: init
grabR: grabR
do something: do something
filter_pixel: filter_pixel
draw_image: draw_image
witch ending: witch ending
story: story
starting path: starting path
jump: jump
patrol: patrol
fill in bg: fill in bg
draw grid1: draw grid1
draw lines: draw lines
Draw a Square Line: Draw a Square Line
Draw a triangle: Draw a triangle
Draw a Cube: Draw a Cube
draw a cube: draw a cube
draw an octagon 20: draw an octagon 20
Draw a square: Draw a square
cube: cube
do something2: do something2
jump upper right: jump upper right
draw a line of squares: draw a line of squares
draw a line of squares: draw a line of squares
Draw Square Line: Draw Square Line
jump upper left: jump upper left
draw a line of octagons: draw a line of octagons
draw a square line: draw a square line
Draw a Square: Draw a Square
draw a square 20: draw a square 20
draw a square 40: draw a square 40
draw a triangle with length: draw a triangle with length
Draw a Triangle with length: Draw a Triangle with length
draw a triangle wioth length: draw a triangle wioth length
draw a sqaure: draw a sqaure
triangle: triangle
draw a spiral shape: draw a spiral shape
get 3 nectar: get 3 nectar
get many nectar: get many nectar
get nectar make honey: get nectar make honey
draw an octagon: draw an octagon
draw octagons: draw octagons
shift down: shift down
level_up: level_up
score_points: score_points
set score: set score
draw a line of hexagons: draw a line of hexagons
shift down/forward: shift down/forward
shift down/backward: shift down/backward
get nectar: get nectar
make honey up and over: make honey up and over
setActors: setActors
popCharacter: popCharacter
patrol left right: patrol left right
empty function: empty function
check guess: check guess
Jump: Jump
test: test
build bridge: build bridge
run right: run right
spin right: spin right
grow forever: grow forever
draw grass: draw grass
sun: sun
draw windows: draw windows
square: square
draw a door: draw a door
rectangle: rectangle
diamond: diamond
window: window
n-sided shape: n-sided shape
draw a loop: draw a loop
draw spiral circle: draw spiral circle
draw roof: draw roof
draw rectangle: draw rectangle
move: move
function 1: function 1
function 2: function 2
turn corner: turn corner
destroy and move: destroy and move
clear path: clear path
clear cacti: clear cacti
place and move: place and move
cover lava: cover lava
build short bridge: build short bridge
build long bridge: build long bridge
create trail: create trail
move and fill: move and fill
fix right corner: fix right corner
fix left corner: fix left corner
make segment: make segment
fix long path: fix long path
fix short path: fix short path
place 3 tracks: place 3 tracks
clear right corner: clear right corner
clear left corner: clear left corner
draw a spiral edge: draw a spiral edge
draw a pentagon: draw a pentagon
artist jump around: artist jump around
Draw lenses: Draw lenses
25 pixel square: 25 pixel square
draw eye: draw eye
Make a Dot: Make a Dot
bubble sort: bubble sort
move right: move right
say number: say number
move up: move up
move down: move down
move left: move left
kill alien: kill alien
click: click
Send Actor 1 to opposite: Send Actor 1 to opposite
blink actor 1: blink actor 1
my function: my function
Squares row: Squares row
draw first part of heart: draw first part of heart
check win: check win
curvy corner: curvy corner
make triangle: make triangle
my behavior: my behavior
'"simple" solution': '"simple" solution'
potential solution: potential solution
my design: my design
get 3 nectar or honey: get 3 nectar or honey
move and collect: move and collect
check nectar or honey: check nectar or honey
row of nectar: row of nectar
rowOfNectar: rowOfNectar
move and check: move and check
win game: win game
lose game: lose game
keep playing: keep playing
Ask a question: Ask a question
draw pinwheel: draw pinwheel
draw background: draw background
move and get nectar with counter: move and get nectar with counter
pick row: pick row
draw flame: draw flame
draw fire: draw fire
booster: booster
draw line of triangles: draw line of triangles
draw a window: draw a window
draw a plane of squares: draw a plane of squares
draw hexagon: draw hexagon
draw line of hexagons: draw line of hexagons
staggered squares: staggered squares
draw line of polygons: draw line of polygons
draw polygon: draw polygon
honey nectar: honey nectar
move and make honey: move and make honey
collect all nectar: collect all nectar
get all nectar: get all nectar
get pumpkin: get pumpkin
harvest: harvest
get corn and come back: get corn and come back
pick along path: pick along path
check square for corn: check square for corn
get all pumpkins: get all pumpkins
pumpkin square: pumpkin square
navigate: navigate
check and pick: check and pick
find pumpkin: find pumpkin
wander path: wander path
get produce: get produce
check for corn: check for corn
corn rectangle: corn rectangle
lettuce stairs: lettuce stairs
pick veggie: pick veggie
corn and pumpkin: corn and pumpkin
go get pumpkins: go get pumpkins
go get lettuce: go get lettuce
garden square: garden square
get corn come back: get corn come back
checker: checker
Make gingham: Make gingham
black outline: black outline
draw a square2: draw a square2
filled square: filled square
get only nectar: get only nectar
only make honey: only make honey
collect row: collect row
rowOfNectarOrHoney: rowOfNectarOrHoney
collect stairs: collect stairs
collect: collect
move and increment: move and increment
do something3: do something3
Robin Fly: Robin Fly
Robot Jump: Robot Jump
Center Dragon: Center Dragon
Dragon Fly: Dragon Fly
Knight Surge: Knight Surge
Stop Dragon: Stop Dragon
Knight Jump: Knight Jump
robotThinking: robotThinking
fill area with color: fill area with color
draw a line of triangles: draw a line of triangles
check flower: check flower
get next row: get next row
check space: check space
follow path: follow path
physics: physics
initialization: initialization
Make Actor 1 Jump: Make Actor 1 Jump
Choose Number: Choose Number
Move Bird: Move Bird
turn left: turn left
move forward: move forward
turn right: turn right
drawDot: drawDot
draw a rectangle: draw a rectangle
Which Course for My Students?: Which Course for My Students?
draw a heart: draw a heart
34 changes: 34 additions & 0 deletions dashboard/test/controllers/sections_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ class SectionsControllerTest < ActionController::TestCase
end

setup do
# Expect any scripts/courses to be valid unless specified by test
Course.stubs(:valid_course_id?).returns(true)
Script.stubs(:valid_script_id?).returns(true)

# place in setup instead of setup_all otherwise course ends up being serialized
# to a file if levelbuilder_mode is true
@course = create(:course)
Expand Down Expand Up @@ -196,6 +200,36 @@ class SectionsControllerTest < ActionController::TestCase
assert_equal(false, section_with_script.hidden)
end

test "update: course_id is not updated if invalid" do
Course.stubs(:valid_course_id?).returns(false)

sign_in @teacher
section = create(:section, user: @teacher, course_id: nil)

post :update, params: {
id: section.id,
course_id: 1,
}
section.reload
assert_response :success
assert_nil section.course_id
end

test "update: script_id is not updated if invalid" do
Script.stubs(:valid_script_id?).returns(false)

sign_in @teacher
section = create(:section, user: @teacher, script_id: nil)

post :update, params: {
id: section.id,
script_id: 1,
}
section.reload
assert_response :success
assert_nil section.script_id
end

test "update: cannot update section you dont own" do
other_teacher = create(:teacher)
sign_in other_teacher
Expand Down

0 comments on commit c512218

Please sign in to comment.