Skip to content

Commit

Permalink
Merge pull request #32654 from code-dot-org/dtp_candidate_3d1fe412
Browse files Browse the repository at this point in the history
DTP (Test > Production: 3d1fe41)
  • Loading branch information
clareconstantine committed Jan 14, 2020
2 parents 3915715 + 18041b3 commit 7c35939
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 120 deletions.
6 changes: 3 additions & 3 deletions apps/src/storage/dataBrowser/datasetManifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"current": false
},
{
"name": "weather",
"description": "Live weather five-day forecast data for 100 cities. Updates daily with expected weather conditions in three-hour intervals.",
"name": "Daily Weather",
"description": "Live weather five-day forecast data for 100 cities. Updates daily with expected weather conditions.",
"current": true
},
{
Expand All @@ -30,7 +30,7 @@
{
"name": "Test Data",
"description": "datasets that are in the shared channel in dev firebase",
"datasets": ["cats", "dogs", "states", "weather", "words"]
"datasets": ["cats", "dogs", "states", "Daily Weather", "words"]
},
{
"name": "Animals",
Expand Down
14 changes: 14 additions & 0 deletions apps/src/templates/sectionProgress/SectionProgress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,20 @@ class SectionProgress extends Component {

onChangeLevel = lessonOfInterest => {
this.props.setLessonOfInterest(lessonOfInterest);

firehoseClient.putRecord(
{
study: 'teacher_dashboard_actions',
study_group: 'progress',
event: 'jump_to_lesson',
data_json: JSON.stringify({
section_id: this.props.section.id,
script_id: this.props.scriptId,
stage_id: this.props.scriptData.stages[lessonOfInterest].id
})
},
{includeUserId: true}
);
};

renderTooltips() {
Expand Down
9 changes: 6 additions & 3 deletions apps/src/templates/sectionProgress/SectionProgressToggle.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class SectionProgressToggle extends React.Component {
// Redux provided
currentView: PropTypes.string.isRequired,
setCurrentView: PropTypes.func.isRequired,
sectionId: PropTypes.number
sectionId: PropTypes.number,
scriptId: PropTypes.number
};

onChange = selectedToggle => {
Expand All @@ -38,7 +39,8 @@ class SectionProgressToggle extends React.Component {
data_json: JSON.stringify({
section_id: this.props.sectionId,
old_view: this.props.currentView,
new_view: selectedToggle
new_view: selectedToggle,
script_id: this.props.scriptId
})
},
{includeUserId: true}
Expand Down Expand Up @@ -90,7 +92,8 @@ export const UnconnectedSectionProgressToggle = SectionProgressToggle;
export default connect(
state => ({
currentView: state.sectionProgress.currentView,
sectionId: state.sectionProgress.section.id
sectionId: state.sectionData.section.id,
scriptId: state.scriptSelection.scriptId
}),
dispatch => ({
setCurrentView(viewType) {
Expand Down
7 changes: 4 additions & 3 deletions apps/src/templates/sectionProgress/sectionProgressRedux.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const addStudentLevelPairing = (scriptId, studentLevelPairing) => {

export const jumpToLessonDetails = lessonOfInterest => {
return (dispatch, getState) => {
const state = getState().sectionProgress;
const state = getState();
dispatch(setLessonOfInterest(lessonOfInterest));
dispatch(setCurrentView(ViewType.DETAIL));
firehoseClient.putRecord(
Expand All @@ -82,9 +82,10 @@ export const jumpToLessonDetails = lessonOfInterest => {
study_group: 'progress',
event: 'view_change_toggle',
data_json: JSON.stringify({
section_id: state.section.id,
section_id: state.sectionData.section.id,
old_view: ViewType.SUMMARY,
new_view: ViewType.DETAIL
new_view: ViewType.DETAIL,
script_id: state.scriptSelection.scriptId
})
},
{includeUserId: true}
Expand Down
71 changes: 54 additions & 17 deletions bin/cron/applab_datasets/weather → bin/cron/applab_datasets/daily_weather
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,20 @@ require_relative '../../../deployment'
require 'cdo/only_one'
require 'net/http'
require 'json'
require 'ostruct'
require 'date'
require_relative '../../../shared/middleware/helpers/firebase_helper'

WeatherForecastOffice = Struct.new(:city, :state, :zip)
WeatherRecord = Struct.new(:id, :city, :state, :timestamp, :temp_min, :temp_max, :weather, :icon, :wind_speed)

API_KEY = '6e86f0c363cd54b5645603030b2f0f76'
NUM_DAYS = 5

def cardinal_dir_from_degrees(degrees)
return '' unless degrees.is_a? Numeric
dirs = %w(N NE E SE S SW W NW N)
return dirs[(degrees / 45).round]
end

def get_weather_data
forecast_offices = [
Expand Down Expand Up @@ -136,27 +146,53 @@ def get_weather_data
WeatherForecastOffice.new('Spokane', 'Washington', '99224')
]
records = {}
columns = %w(id city state timestamp temp_min temp_max weather icon wind_speed)
columns = ['id', 'State', 'City', 'Forecast Number', 'Date', 'Main Condition', 'Condition Description', 'Icon',
'Low Temperature', 'High Temperature', 'Humidity Percentage', 'Wind MPH', 'Wind Direction', 'Rain Inches',
'Snow Inches', 'Pressure', 'Cloud Percent', 'UTC Timestamp', 'Timezone Offset']

id = 1
forecast_offices.each do |office|
url = "http://api.openweathermap.org/data/2.5/forecast?zip=#{office.zip},us&units=imperial&appid=c719e74bc77b787d940386405e0cbb83"
forecast_number = 1

url = "http://api.openweathermap.org/data/2.5/forecast/daily?zip=#{office.zip},us&cnt=#{NUM_DAYS}&units=imperial&appid=#{API_KEY}"
response = Net::HTTP.get_response(URI(url))
next unless response.code == '200'
measurements = JSON.parse(response.body)["list"]

parsed_response = JSON.parse(response.body)
measurements = parsed_response['list']
measurements.each do |measurement|
row = WeatherRecord.new(
id,
office.city,
office.state,
measurement["dt_txt"],
measurement["main"]["temp_min"],
measurement["main"]["temp_max"],
measurement["weather"][0]["description"],
measurement["weather"][0]["icon"],
measurement["wind"]["speed"]
)
records[id] = row.to_h.to_json
record = OpenStruct.new
record.id = id
record.State = office.state
record.City = office.city
record['Forecast Number'] = forecast_number

# list.dt gives timestamp of forecast in UTC, city.timezone gives shift in seconds from UTC
parsed_date = Time.at(measurement['dt'] - parsed_response['city']['timezone'])
record.Date = parsed_date.strftime('%a %-m/%-d') # ex Wed 1/7

weather_condition = measurement['weather'][0]
record['Main Condition'] = weather_condition['main']
record['Condition Description'] = weather_condition['description']
record.Icon = format('http://openweathermap.org/img/wn/%s@2x.png', weather_condition['icon'])

record['Low Temperature'] = measurement['temp']['min']
record['High Temperature'] = measurement['temp']['max']
record['Humidity Percentage'] = measurement['humidity']
record['Wind MPH'] = measurement['speed'].round
record['Wind Direction'] = cardinal_dir_from_degrees(measurement['deg'])

record['Rain Inches'] = measurement['rain'] || 0
record['Snow Inches'] = measurement['snow'] || 0

record['Pressure'] = measurement['pressure']
record['Cloud Percent'] = measurement['clouds']
record['UTC Timestamp'] = measurement['dt']
record['Timezone Offset'] = parsed_response['city']['timezone']

records[id] = record.to_h.to_json
id += 1
forecast_number += 1
end
end
return records, columns
Expand All @@ -165,7 +201,8 @@ end
def main
fb = FirebaseHelper.new('shared')
records, columns = get_weather_data
fb.upload_shared_table('weather', records, columns)
fb.delete_shared_table('Daily%20Weather')
fb.upload_shared_table('Daily%20Weather', records, columns)
end

main if only_one_running?(__FILE__)
3 changes: 2 additions & 1 deletion bin/cron/teacher_applications_to_gdrive
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ end
drive = Google::Drive.new service_account_key: StringIO.new(CDO.gdrive_export_secret.to_json)
drive.update_sheet applications, CDO.applications_2020_2021_gsheet_key, 'all_apps (auto)'

last_updated = DateTime.now.in_time_zone ActiveSupport::TimeZone.new "Pacific Time (US & Canada)"
metadata = [
['AUTOMATION METADATA'],
[''],
['The tabs "all_apps (auto)" and "meta (auto)" are auto-generated;'],
['Any edits you make to them (besides formatting) may be lost.'],
[''],
['Last updated:', DateTime.now.strftime('%Y-%m-%d %l:%M%P GMT%:::z')],
['Last updated:', last_updated.strftime('%Y-%m-%d %l:%M%P GMT%:::z')],
['Written by:', CDO.gdrive_export_secret.client_email],
['Teacher applications:', applications.length - 1],
[''],
Expand Down
2 changes: 1 addition & 1 deletion dashboard/app/controllers/maker_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def discountcode
script_data: {
application: application_status,
is_admin: current_user.admin?,
currently_distributing_discount_codes: false
currently_distributing_discount_codes: true
}
}
end
Expand Down
97 changes: 7 additions & 90 deletions dashboard/config/scripts/dup_markdown_test_bethany.external
Original file line number Diff line number Diff line change
@@ -1,97 +1,14 @@
name 'dup_markdown_test_bethany'
editor_experiment ''
skip_dialog true
markdown <<MARKDOWN
# Course outline
# Example
I would recommend having the console open -- there are JS errors. At some point, if you inspect the preview area, there will be an unclosed `react-text` comment

The course is divided into four concept chunks, which each have lessons in them. Lessons consists of different "levels", which are colloquially referred to as bubbles, stages, or puzzles by students and teachers. Here's an overview of what you'll learn if you complete the entire course:
To repro, add about 3 bullets here:

## Getting Started

### Lesson 1: Welcome to 'Teaching Computer Science Fundamentals' (15 minutes)
- Review the course details
- Understand what computer science is and differentiate between "coding" and computer science"
- Identify the benefits of teaching and learning computer science
- Plan your participation in this course

### Lesson 2: Getting to know the Computer Science Fundamentals Courses (15-20 minutes)
- Become familiar with the content and organization of the Computer Science Fundamentals courses
- Identify which course is most appropriate for your students
- Understand the importance of the teacher in the Computer Science Fundamentals curriculum
- Understand different types of Computer Science Fundamentals lessons

## Basic Coding Concepts and Teaching Practices

### Lesson 3: Sequencing (15-45 minutes)
- Define "program" and "algorithm"
- Identify where sequencing is introduced in the Computer Science Fundamentals courses
- Use the Code.org visual programming engine to write simple programs
- Explore an unplugged lesson on sequencing and reflect on classroom application
- Think about how to use lesson plans

### Lesson 4: Loops (15-45 minutes)
- Define "loops" and explain their importance
- Identify where loops are introduced in the Computer Science Fundamentals courses
- Explore an unplugged lesson on loops and reflect on classroom application
- Practice coding simple loops
- Understand the benefits of pair programming

### Lesson 5: Events (15-45 minutes)
- Define "events" and explain their importance
- Identify where events are introduced in the Computer Science Fundamentals courses
- Explore an unplugged lesson on events and reflect on classroom application
- Practice coding simple events
- Understand the debugging process

### Lesson 6: Conditionals (15-45 minutes)
- Define "conditionals" and explain their importance
- Identify where conditionals are introduced in the Computer Science Fundamentals courses
- Explore an unplugged lesson on conditionals and reflect on classroom application
- Practice coding simple conditionals
- Understand the teaching practice of journaling

### Lesson 7: End of Course Projects (15-45 minutes)
- Understand the benefit of end of course projects
- Identify where end of course projects are introduced in the Computer Science Fundamentals courses
- Practice coding a project

## [Optional] Diving Deeper: Courses E and F
You will want to complete this section if you are teaching Courses E or F. This section dives into some of the harder concepts covered in these courses for older students.

### Lesson 8: Functions (30-45 minutes)
- Identify if you will be teaching Courses E or F to students
- Define "functions" and explain their importance
- Identify where functions are introduced in the Computer Science Fundamentals courses
- Explore the unplugged lesson on functions and reflect on classroom application
- Practice coding simple functions

### Lesson 9: Variables (30-45 minutes)
- Define "variable" and explain its importance
- Identify where variables are introduced in the Computer Science Fundamentals courses
- Explore the unplugged lesson on variables and reflect on classroom application
- Practice coding with variables

### Lesson 10: For Loops (30-45 minutes)
- Define "for loops" and explain its importance
- Identify where for loops are introduced in the Computer Science Fundamentals courses
- Explore the unplugged lesson on for loops and reflect on classroom application
- Practice coding with for loops

### Lesson 11: Sprite Lab (15-45 minutes)
- Define "sprite" and "behavior"
- Identify where sprites and behaviors are introduced in the Computer Science Fundamentals courses
- Explore the coding environment Sprite Lab

## Next Steps

### Lesson 12: Reviewing your Reflections (15 minutes)
- Review the reflections you have made throughout the course so far

### Lesson 13: Next Steps (15 minutes)
- Explore teacher resources
- Plan for next steps you can take to continue your learning
- Connect with a global community of fellow educators interested in computer science education
- Share your takeaways and feedback on this course

> **Note**: Suggested times are provided above to help you plan your learning. Please note that you may want to spend more or less time on a given stage, depending on your prior knowledge, interest and capacity. Keep in mind that this course is entirely self-paced; you can always leave the course and come back or revisit any stage or level at any time.
### Header 1

### Header 2 (needed)
A description is necessary here
MARKDOWN

0 comments on commit 7c35939

Please sign in to comment.