Skip to content

Commit

Permalink
Merge pull request #20075 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 Jan 17, 2018
2 parents 9616b5e + fefd3e4 commit b73a328
Show file tree
Hide file tree
Showing 39 changed files with 494 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class SummerWorkshopAssignmentLoader extends React.Component {
workshops: data.workshops.map(workshop => {
return {
value: workshop.id,
label: workshop.short_name
label: workshop.date_and_location_name
};
})
});
Expand Down
4 changes: 2 additions & 2 deletions dashboard/app/controllers/featured_projects_controller.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
class FeaturedProjectsController < ApplicationController
def create
unless current_user.try(:permission?, UserPermission::LEVELBUILDER) || current_user.try(:permission?, UserPermission::RESET_ABUSE)
unless current_user.try(:permission?, UserPermission::PROJECT_VALIDATOR)
_, channel_id = storage_decrypt_channel_id(featured_project_params[:project_id])
@featured_project = FeaturedProject.create({storage_app_id: channel_id, who_featured_user_id: current_user.id})
@featured_project.save!
end
end

def destroy_by_project_id
unless current_user.try(:permission?, UserPermission::LEVELBUILDER) || current_user.try(:permission?, UserPermission::RESET_ABUSE)
unless current_user.try(:permission?, UserPermission::PROJECT_VALIDATOR)
_, channel_id = storage_decrypt_channel_id(params[:project_id])
@featured_project = FeaturedProject.find_by_storage_app_id(channel_id)
@featured_project.destroy
Expand Down
2 changes: 1 addition & 1 deletion dashboard/app/controllers/level_sources_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def original_image
protected

def set_level_source
reset_abuse_user = current_user && current_user.permission?(UserPermission::RESET_ABUSE)
reset_abuse_user = current_user && current_user.permission?(UserPermission::PROJECT_VALIDATOR)
# Depending on the url route, one of params[:level_source_id_and_user_id] (for /r/ links) or
# params[:id] (for /c/ links) is set. For the former, deobfuscate the level_source_id.
level_source_id =
Expand Down
2 changes: 1 addition & 1 deletion dashboard/app/helpers/levels_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ def blockly_options
app_options[:firebaseAuthToken] = firebase_auth_token
app_options[:firebaseChannelIdSuffix] = CDO.firebase_channel_id_suffix
end
app_options[:canResetAbuse] = true if current_user && current_user.permission?(UserPermission::RESET_ABUSE)
app_options[:canResetAbuse] = true if current_user && current_user.permission?(UserPermission::PROJECT_VALIDATOR)
app_options[:isSignedIn] = !current_user.nil?
app_options[:isTooYoung] = !current_user.nil? && current_user.under_13? && current_user.terms_version.nil?
app_options[:pinWorkspaceToBottom] = true if l.enable_scrolling?
Expand Down
2 changes: 1 addition & 1 deletion dashboard/app/models/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def initialize(user)
end
end

if user.persisted? && user.permission?(UserPermission::RESET_ABUSE)
if user.persisted? && user.permission?(UserPermission::PROJECT_VALIDATOR)
# let them change the hidden state
can :manage, LevelSource
end
Expand Down
7 changes: 7 additions & 0 deletions dashboard/app/models/pd/workshop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,13 @@ def friendly_date_range
"#{sessions.first.start.strftime('%B %-d')} - #{sessions.last.start.strftime('%B %-d, %Y')}"
end

def date_and_location_name
date_string = sessions.any? ? friendly_date_range : 'Dates TBA'
location_string = processed_location ? "#{location_city} #{location_state}" : 'Location TBA'

"#{date_string}, #{location_string}#{teachercon? ? ' TeacherCon' : ''}"
end

# Puts workshop in 'In Progress' state
def start!
raise 'Workshop must have at least one session to start.' if sessions.empty?
Expand Down
5 changes: 2 additions & 3 deletions dashboard/app/models/user_permission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ class UserPermission < ActiveRecord::Base
# Also grants access to viewing extra links related to editing these.
# Also makes the account satisfy authorized_teacher?.
LEVELBUILDER = 'levelbuilder'.freeze,
# Grants access to reseting (to 0) the abuse score for projects,
# and blocking and unblocking legacy shares.
RESET_ABUSE = 'reset_abuse'.freeze,
# Grants ability to (un)feature projects in the the public project gallery.
# Also, grants access to resetting (to 0) the abuse score for projects,
# and blocking and unblocking legacy shares (formerly RESET_ABUSE).
PROJECT_VALIDATOR = 'project_validator'.freeze,
# Grants access to PLC workshop dashboards.
WORKSHOP_ADMIN = 'workshop_admin'.freeze,
Expand Down
8 changes: 1 addition & 7 deletions dashboard/app/serializers/api/v1/pd/workshop_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Api::V1::Pd::WorkshopSerializer < ActiveModel::Serializer
attributes :id, :organizer, :location_name, :location_address, :course,
:subject, :capacity, :notes, :state, :facilitators,
:enrolled_teacher_count, :sessions, :account_required_for_attendance?,
:enrollment_code, :on_map, :funded, :ready_to_close?, :short_name
:enrollment_code, :on_map, :funded, :ready_to_close?, :date_and_location_name

def sessions
object.sessions.map do |session|
Expand All @@ -57,10 +57,4 @@ def enrolled_teacher_count
def enrollment_code
@scope.try(:[], :enrollment_code)
end

def short_name
return '' unless object.sessions.any? && object.processed_location

"#{object.friendly_date_range}, #{object.location_city} #{object.location_state}#{object.teachercon? ? ' TeacherCon' : ''}"
end
end
4 changes: 2 additions & 2 deletions dashboard/app/views/level_sources/_admin.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- if current_user && current_user.permission?(UserPermission::RESET_ABUSE)
- if current_user && current_user.permission?(UserPermission::PROJECT_VALIDATOR)
= render layout: 'shared/extra_links' do
- if @level_source.hidden?
%h4 This level is hidden but you can see it because you have the RESET_ABUSE permission. Everyone else gets a 404 page.
%h4 This level is hidden but you can see it because you have the PROJECT_VALIDATOR permission. Everyone else gets a 404 page.
= form_for(@level_source, html: {class: 'form-inline'}) do |f|
= f.label :hidden, 'Hide this solution and block sharing: '
= f.check_box :hidden
Expand Down
4 changes: 2 additions & 2 deletions dashboard/app/views/levels/_admin.html.haml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
- if current_user && (current_user.permission?(UserPermission::LEVELBUILDER) || current_user.permission?(UserPermission::RESET_ABUSE) || current_user.permission?(UserPermission::PROJECT_VALIDATOR))
- if current_user && (current_user.permission?(UserPermission::LEVELBUILDER) || current_user.permission?(UserPermission::PROJECT_VALIDATOR))
= render layout: 'shared/extra_links' do
%strong= @level.name
- if current_user.permission?(UserPermission::LEVELBUILDER)
Expand Down Expand Up @@ -85,7 +85,7 @@
%button{id: "feature", class: "btn btn-default btn-sm"}
Feature in gallery
- if current_user.permission?(UserPermission::RESET_ABUSE)
- if current_user.permission?(UserPermission::PROJECT_VALIDATOR)
%br
%div.admin-abuse{ :style => "display: none" }
Abuse score:
Expand Down
4 changes: 2 additions & 2 deletions dashboard/config/locales/dsls.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10246,8 +10246,8 @@ en:
Laurel will collect 4 pieces of treasure using this code.: Laurel will collect 4 pieces of treasure using this code.
Laurel will collect all of the treasure.: Laurel will collect all of the treasure.
Laurel will only be able to collect 2 pieces of treasure using this code.: Laurel will only be able to collect 2 pieces of treasure using this code.
? Look closely at the code below. If the code were to run all the way to the end, how many pieces of treasure would Laurel collect?
: Look closely at the code below. If the code were to run all the way to the end, how many pieces of treasure would Laurel collect?
? Look closely at the code below. If the code were to run to the end (ignoring any errors) how many pieces of treasure would Laurel collect?
: Look closely at the code below. If the code were to run to the end (ignoring any errors) how many pieces of treasure would Laurel collect?
image code from circle:
(rectangle (+ 8 2) (- 7 5) "solid" "red"): (rectangle (+ 8 2) (- 7 5) "solid" "red")
"(rectangle (+ 8 2) (- 7 5) solid red)": "(rectangle (+ 8 2) (- 7 5) solid red)"
Expand Down
3 changes: 3 additions & 0 deletions dashboard/config/scripts/csd6-draft.script
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,9 @@ level 'CSD U6 Airplane predict', progression: 'Orientation'
level 'CSD U6 directional leds pitch', progression: 'Orientation'
level 'CSD U6 directional LEDs roll', progression: 'Orientation'
level 'CSD U6 direction theremin', progression: 'Orientation'
named_level 'Using Accelerometer Events'
level 'CSD U6 goalie', progression: 'Accelerometer Events'
level 'CSD U6 Driver pt1', progression: 'Accelerometer Events'
level 'CSD U6 stillness game predict code', progression: 'Accelerometer Events'

stage 'Functions with Parameters', flex_category: 'csd6_2'
Expand All @@ -211,6 +213,7 @@ level 'CSD U6 params starchaser 4', progression: 'Star Chaser'

stage 'Circuits and Physical Prototypes', flex_category: 'csd6_2'
named_level 'CSD U6L15 TFMD'
named_level 'CSD U6 circuit logic video'
level 'CSD U6 circuit predict', progression: 'Simple Circuits'
level 'CSD U6 circuit LED map', progression: 'Simple Circuits'
level 'CSD U6 circuit pinMode', progression: 'Simple Circuits'
Expand Down
19 changes: 10 additions & 9 deletions dashboard/config/scripts/csp_algorithms_map.external
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ By asobuno (Own work) [<a href="https://creativecommons.org/licenses/by-sa/3.0">

**Physical Tasks in Daily Life**

Daily life is filled with tasks. For example, most mornings you'll need to get dressed, pack your things, and then travel from one place to another. Your day at work or school will be filled with tasks to complete. Even keeping up with friends, relaxing, or going to bed probably includes some tasks if you look closely.
Daily life is filled with tasks. For example, most mornings you'll need to get dressed, pack your things, and then travel from one place to another. Your day at work or school will be filled with tasks to complete. Even keeping up with friends, relaxing, or going to bed includes some tasks if you look closely.

<div style="clear: both"> </div>

<img src="https://images.code.org/a2835a98c80954695d1db19f0d66cf6b-image-1515092970066.jpg" style="float:right;width:200px">

**Automating Tasks**

Most tasks we want taken care of quickly, easily, and reliably. Sometimes we practice the steps of a task, like tying our shoes, so that we can quickly complete it and move on to other things. In other cases we've made tools to help us complete tasks like shovels to dig holes or ropes to help pull and lift things.

Automation combines these two ideas. If completing a task requires the same predictable set of steps, perhaps we could build a tool that does all those steps for us. As a result humans built amazing machines that could weave cloth, plant and harvest food, or assemble products with little to no human input. This led to enormous shifts in everyday life!
We want to complete most tasks quickly, easily, and reliably. Tasks that are repetitive or have a well-defined set of steps to complete them are good candidates for automation. If completing a task requires the same predictable set of steps, perhaps we could build a tool that does all those steps for us. As a result humans built amazing machines that could weave cloth, plant and harvest food, or assemble products with little to no human input. This led to enormous shifts in everyday life!

<div style="clear: both"></div>

Expand All @@ -43,7 +41,7 @@ By Clem Rutter, Rochester, Kent. (self) [<a href="http://www.gnu.org/copyleft/fd

**Automation Requires Algorithms**

To automate a task you of course need the materials to design and build your machine, but just as important you need to know the precise steps the machine should be built to complete. A machine to weave cloth needs to know precisely how to make each stitch, and a machine to plant crops needs to know how close to plant each seed. In other words, in order to automate processes you need the precise sequence of steps, or algorithm, your machine will be designed to implement!
If we can define A machine to weave cloth needs to know precisely how to make each stitch, and a machine to plant crops needs to know how close to plant each seed. In other words, in order to automate processes you need the precise sequence of steps, or algorithm, your machine will be designed to implement!

<div style="clear: both"> </div>

Expand All @@ -55,17 +53,20 @@ Many tasks don't require physical work, but they do require thinking. For exampl

**Automating Information Tasks**

Many information tasks can be completed using step-by-step algorithms. For example when you learn the steps to add or multiply two numbers, you're really just practicing an algorithm. Tools like a mechanical cash register are built to implement those algorithms and help automate a task.
Many information tasks can be completed using step-by-step algorithms. For example when you learn the steps to add or multiply two numbers, you're really just using an algorithm for multiplication. Tools like a mechanical cash register help automate information tasks that can be expressed as an algorithms.

## Algorithms, Programming, and Computer Science

**The Everything Machine**

Through history machines to automate thinking tasks usually did only one thing. A machine could track stars in the sky, or add numbers, but couldn't do both. By comparison, a single modern computer can add numbers, show video, communicate over the Internet, and play music. This is clearly a very different type of machine!
Through history machines to automate information tasks usually did only one thing. A machine could track stars in the sky, or add numbers, but couldn't do both. By comparison, a single modern computer can add numbers, show video, communicate over the Internet, and play music. This is clearly a very different type of machine!

Many important ideas led to the design of the modern computer. First was the realization that many information tasks can be represented as simple manipulations of numbers. In fact, you learned in Units 1 and 2 that text, images, and sound information on a computer have ways of being represented as binary numbers.


In order to achieve this, computers were designed to complete a set of simple commands that are likely to come up in many information problems. For example a computer is able to add and subtract numbers, move information from one place to another, and compare numbers. This is because at a low level you'll actually find that most information tasks require this same set of commands.
In order to achieve this, computers were designed to perform a set of very simple commands that come up in many information problems. For example a computer is able to add and subtract numbers, move information from one place to another, and compare numbers. This is because at a low level you'll actually find that most information tasks require this same set of commands.

Rather than being designed to do one task, a computer lets a human being write out the steps in which it uses the different commands it's designed to understand. Depending on the task the human wants the computer to complete they'll write a different sequence of commands. Said another way, a computer is a machine that's designed for a human to write algorithms for it to run!
Rather than being designed to do one task, a computer lets a human being write out the steps to complete an information task using the commands the computer understands. Depending on the task the human wants the computer to complete they'll write a different sequence of commands. Said another way, a computer is a machine that's designed for a human to write algorithms for it to run!

## Algorithms and Creativity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'grade2_multi_collector_A_predict1'
question 'Look closely at the code below. If the code were to run all the way to the end, how many pieces of treasure would Laurel collect?'
question 'Look closely at the code below. If the code were to run to the end (ignoring any errors) how many pieces of treasure would Laurel collect?'
wrong 'Laurel will collect 4 pieces of treasure using this code.', feedback: 'Incorrect. Laurel tries to collect treasure in 4 spaces, but 2 of them are empty, so she only collects 2 pieces of treasure.'
right 'Laurel will only be able to collect 2 pieces of treasure using this code.', feedback: 'Correct!'
wrong 'Laurel will collect all of the treasure.', feedback: 'Incorrect. Laurel tries to collect treasure in 4 spaces, but 2 of them are empty, so she only collects 2 pieces of treasure.'
Expand Down
14 changes: 10 additions & 4 deletions dashboard/config/scripts/levels/CSD U3 L9 Freeplay.level
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"submittable": "true",
"hide_view_data_button": "false",
"debugger_disabled": "false",
"markdown_instructions": "# Free Play\r\n\r\nUse what you've learned to create whatever you like. When you're finished, you can click ![](https://images.code.org/2fd36aba2af21d292932b77fb0b9fd0e-image-1498689573973.36.43 PM.png) to send your creation to a friend, or ![](https://images.code.org/1ddae93513aff160349643f1909590e8-image-1498689597186.36.50 PM.png) to send it to your Projects Gallery.\r\n",
"markdown_instructions": "# Free Play\r\n\r\nUse what you've learned to create whatever you like. When you're finished, you can click ![](https://images.code.org/2fd36aba2af21d292932b77fb0b9fd0e-image-1498689573973.36.43 PM.png) to send your creation to a friend, or ![](https://images.code.org/1ddae93513aff160349643f1909590e8-image-1498689597186.36.50 PM.png) to send it to your Projects Gallery.",
"instructions_important": "false",
"hide_share_and_remix": "false",
"disable_if_else_editing": "false",
Expand Down Expand Up @@ -71,14 +71,20 @@
"addOperator": null,
"subtractOperator": null,
"multiplyOperator": null,
"divideOperator": null
"divideOperator": null,
"World.frameRate": null
},
"display_name": "Free Play",
"contained_level_names": null
"contained_level_names": null,
"encrypted_examples": [

],
"disable_procedure_autopopulate": "false",
"top_level_procedure_autopopulate": "false"
},
"published": true,
"notes": "",
"audit_log": "[{\"changed_at\":\"2017-06-08 19:24:10 +0000\",\"changed\":[\"markdown_instructions\",\"code_functions\",\"contained_level_names\"],\"changed_by_id\":324,\"changed_by_email\":\"elizabeth@code.org\"},{\"changed_at\":\"2017-06-28 23:03:57 +0000\",\"changed\":[\"markdown_instructions\",\"code_functions\",\"project_template_level_name\",\"contained_level_names\"],\"changed_by_id\":324,\"changed_by_email\":\"elizabeth@code.org\"},{\"changed_at\":\"2017-06-28 23:31:35 +0000\",\"changed\":[\"code_functions\",\"contained_level_names\",\"encrypted_examples\"],\"changed_by_id\":324,\"changed_by_email\":\"elizabeth@code.org\"}]",
"audit_log": "[{\"changed_at\":\"2017-06-08 19:24:10 +0000\",\"changed\":[\"markdown_instructions\",\"code_functions\",\"contained_level_names\"],\"changed_by_id\":324,\"changed_by_email\":\"elizabeth@code.org\"},{\"changed_at\":\"2017-06-28 23:03:57 +0000\",\"changed\":[\"markdown_instructions\",\"code_functions\",\"project_template_level_name\",\"contained_level_names\"],\"changed_by_id\":324,\"changed_by_email\":\"elizabeth@code.org\"},{\"changed_at\":\"2017-06-28 23:31:35 +0000\",\"changed\":[\"code_functions\",\"contained_level_names\",\"encrypted_examples\"],\"changed_by_id\":324,\"changed_by_email\":\"elizabeth@code.org\"},{\"changed_at\":\"2018-01-17 18:18:44 +0000\",\"changed\":[\"markdown_instructions\",\"code_functions\",\"contained_level_names\"],\"changed_by_id\":324,\"changed_by_email\":\"elizabeth@code.org\"}]",
"level_concept_difficulty": {
}
}]]></config>
Expand Down

0 comments on commit b73a328

Please sign in to comment.