Skip to content

Commit

Permalink
Merge pull request #33718 from code-dot-org/dtp_candidate_861fd51a
Browse files Browse the repository at this point in the history
DTP (Test > Production: 861fd51)
  • Loading branch information
Erin Peach committed Mar 18, 2020
2 parents ea1675f + ba0704c commit 96eeed7
Show file tree
Hide file tree
Showing 694 changed files with 32,204 additions and 486 deletions.
20 changes: 12 additions & 8 deletions apps/src/lib/kits/maker/portScanning.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,18 @@ export function ensureAppInstalled() {
* @returns {Promise.<Array.<SerialPortInfo>>}
*/
function listSerialDevices() {
const SerialPortType = isNodeSerialAvailable()
? SerialPort
: ChromeSerialPort;
return new Promise((resolve, reject) => {
SerialPortType.list((error, list) =>
error ? reject(error) : resolve(list)
);
});
let SerialPortType;
if (isNodeSerialAvailable()) {
SerialPortType = SerialPort;
return SerialPortType.list();
} else {
SerialPortType = ChromeSerialPort;
return new Promise((resolve, reject) => {
SerialPortType.list((error, list) =>
error ? reject(error) : resolve(list)
);
});
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ import {
getUnpluggedLessonsForScript,
setSelectedLessons
} from './sectionStandardsProgressRedux';
import color from '@cdo/apps/util/color';

const styles = {
lessonListItem: {
display: 'flex',
flexDirection: 'row'
},
links: {
paddingLeft: 10,
color: color.teal
}
};

Expand Down Expand Up @@ -52,7 +57,7 @@ const ComplexLessonComponent = function({lesson}) {
lessonNumber={lesson.number}
/>
</div>
<a style={{paddingLeft: 10}} href={lesson.url} target={'_blank'}>
<a style={styles.links} href={lesson.url} target={'_blank'}>
{lesson.name}
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/test/unit/netsim/NetSimLogEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('NetSimLogEntry', function() {
it('gracefully converts a malformed base64Payload to empty string', function() {
var logEntry = new NetSimLogEntry(testShard, {
base64Binary: {
string: 'totally not a base64 string',
string: 'not a base64 string because of the question mark?',
len: 7
}
});
Expand Down
2 changes: 1 addition & 1 deletion apps/test/unit/netsim/NetSimMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ describe('NetSimMessage', function() {
it('gracefully converts a malformed base64Payload to empty string', function() {
var message = new NetSimMessage(testShard, {
base64Payload: {
string: 'totally not a base64 string',
string: 'not a base64 string because of the question mark?',
len: 7
}
});
Expand Down
18 changes: 9 additions & 9 deletions bin/cron/analyze_hoc_activity
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require 'cdo/properties'
require 'dynamic_config/dcdo'

# Provides helper methods (analyze_day_fast and add_hashes) as well as the
# *_DB_READONLY constants.
# *_DB_READER constants.
require_relative '../../lib/analyze_hoc_activity_helper'

# This default number of lines of code is from 2016-11-23.
Expand Down Expand Up @@ -51,10 +51,10 @@ def main
# https://docs.google.com/document/d/1RTTCpkDYZjqZxfVehkZRkk1HckYMvFdFGs6SEZnK1I8
total_started += 14_861_327

today = DateTime.now.to_date
day = Date.strptime('2014/12/06', '%Y/%m/%d')
today = Date.new(2020, 2, 2)
day = Date.new(2020, 2, 1)

while day <= today
while day < today
cache_path = pegasus_dir("cache/HourOfActivity_Results_#{day.strftime('%Y-%m-%d')}.json")
if (day != today) && File.file?(cache_path)
day_data = JSON.load(IO.read(cache_path))
Expand Down Expand Up @@ -82,8 +82,8 @@ def main
# Compute the number of hoc events (the grand total and broken down by company and country).
hoc_country_totals = Hash.new(0)
hoc_company_totals = Hash.new(0)
unique_hoc_events = DB[:forms].where(kind: "HocSignup#{hoc_year}").group(:email, :name).select(:name, :email, :processed_data, :data)
total_hoc_count = DB[:forms].where(kind: "HocSignup#{hoc_year}").group(:email, :name).select(:email, :name).count
unique_hoc_events = PEGASUS_DB_READER[:forms].where(kind: "HocSignup#{hoc_year}").group(:email, :name).select(:name, :email, :processed_data, :data)
total_hoc_count = PEGASUS_DB_READER[:forms].where(kind: "HocSignup#{hoc_year}").group(:email, :name).select(:email, :name).count

unique_hoc_events.each do |row|
data = JSON.parse(row[:data])
Expand Down Expand Up @@ -140,7 +140,7 @@ def main
existing_lines_of_code = metrics['lines_of_code']
lines_of_code = [lines_of_code, existing_lines_of_code].max

petition_signatures = PEGASUS_REPORTING_DB_READONLY[:forms].where(kind: 'Petition').group_by(:hashed_email).count
petition_signatures = PEGASUS_DB_READER[:forms].where(kind: 'Petition').group_by(:hashed_email).count

existing_project_count = metrics['project_count']

Expand All @@ -157,8 +157,8 @@ def main
}

Properties.set :about_stats, {
number_students: DASHBOARD_REPORTING_DB_READONLY[:users].where(user_type: 'student').exclude(last_sign_in_at: nil).count,
number_teachers: DASHBOARD_REPORTING_DB_READONLY[:users].where(user_type: 'teacher').exclude(last_sign_in_at: nil).count,
number_students: DASHBOARD_DB_READER[:users].where(user_type: 'student').exclude(last_sign_in_at: nil).count,
number_teachers: DASHBOARD_DB_READER[:users].where(user_type: 'teacher').exclude(last_sign_in_at: nil).count,
}
end

Expand Down
8 changes: 4 additions & 4 deletions bin/cron/update_project_count
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ MAX_EXECUTION_TIME = 1_200_000
MAX_EXECUTION_TIME_SEC = MAX_EXECUTION_TIME / 1000

# Connection to read from Pegasus reporting database.
PEGASUS_REPORTING_DB_READER = sequel_connect(
CDO.pegasus_reporting_db_reader,
CDO.pegasus_reporting_db_reader,
PEGASUS_DB_READER = sequel_connect(
CDO.pegasus_db_reader,
CDO.pegasus_db_reader,
query_timeout: MAX_EXECUTION_TIME_SEC
)

Expand All @@ -33,7 +33,7 @@ NUMBER_PROJECTS_SIGNIFICANT_DECREASE = 10_000

def main
# Get the current amount of projects.
project_count = PEGASUS_REPORTING_DB_READER[:storage_apps].where(standalone: true).count
project_count = PEGASUS_DB_READER[:storage_apps].where(standalone: true).count

existing_project_count = Properties.get(:metrics)['project_count'] || 0
if (existing_project_count - project_count) >= NUMBER_PROJECTS_SIGNIFICANT_DECREASE
Expand Down
2 changes: 1 addition & 1 deletion cookbooks/Berksfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ GRAPH
cdo-analytics (0.0.0)
apt (~> 2.6.0)
ark (>= 0.0.0)
cdo-apps (0.2.432)
cdo-apps (0.2.434)
apt (>= 0.0.0)
build-essential (>= 0.0.0)
cdo-analytics (>= 0.0.0)
Expand Down
2 changes: 1 addition & 1 deletion cookbooks/cdo-apps/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license 'All rights reserved'
description 'Installs/Configures cdo-apps'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.2.432'
version '0.2.434'

depends 'apt'
depends 'build-essential'
Expand Down
6 changes: 4 additions & 2 deletions cookbooks/cdo-apps/templates/default/crontab.erb
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,16 @@
# background tasks that adhoc instances don't need to run.
unless node.chef_environment == 'adhoc'
cronjob at:'*/1 * * * *', do:deploy_dir('bin', 'cron', 'process_forms')
cronjob at:'35 * * * *', do:deploy_dir('bin', 'cron', 'analyze_hoc_activity')
# temporarily commenting out to test this script manually
# cronjob at:'35 * * * *', do:deploy_dir('bin', 'cron', 'analyze_hoc_activity')
cronjob at:'*/1 * * * *', do:deploy_dir('bin', 'cron', 'deliver_poste_messages')
cronjob at:'*/1 * * * *', do:deploy_dir('bin', 'cron', 'geocode_hoc_activity')
cronjob at:'*/1 * * * *', do:deploy_dir('bin', 'cron', 'form_geos')
cronjob at:'*/1 * * * *', do:deploy_dir('bin', 'cron', 'user_geos')
cronjob at:'0 9 * * 5', do:deploy_dir('bin', 'cron', 'create_rollup_tables')
cronjob at:"0 8 * * *", do:deploy_dir('bin', 'cron', 'purge_expired_deleted_accounts')
cronjob at:'0 4 * * 0', do:deploy_dir('bin', 'cron', 'update_project_count')
# temporarily commenting out to test this script manually
#cronjob at:'0 4 * * 0', do:deploy_dir('bin', 'cron', 'update_project_count')
end
end

Expand Down
37 changes: 37 additions & 0 deletions dashboard/config/blocks/aalab/aalab_moveInDirection.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"category": "Actions",
"config": {
"func": "moveInDirection",
"blockText": "move {SPRITE} {DISTANCE} pixels {DIRECTION}",
"args": [
{
"name": "SPRITE",
"type": "Sprite"
},
{
"name": "DISTANCE"
},
{
"name": "DIRECTION",
"options": [
[
"North",
"\"North\""
],
[
"East",
"\"East\""
],
[
"South",
"\"South\""
],
[
"West",
"\"West\""
]
]
}
]
}
}
3 changes: 3 additions & 0 deletions dashboard/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,9 @@ en:
k5_next_steps: 'Next Steps'
k5_basic_concepts: 'Basic Coding Concepts and Teaching Practices'
k5_diving_deeper: 'Diving Deeper: Courses E and F'
web_lab_projects: 'Web Lab Projects'
game_lab_projects: 'Game Lab Projects'
app_lab_projects: 'App Lab Projects'
external_links:
disclaimer: Disclaimer
leaving_domain: You are now leaving this domain, to a site that is not operated by Code.org.
Expand Down

0 comments on commit 96eeed7

Please sign in to comment.