Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
37862ce
Update uk.coffee
deivan Aug 6, 2020
37846bd
admin teacher cannot access licenses page (#5926)
smallst Aug 8, 2020
22fa332
feat: switch to live classes homepage banner (#5927)
jmif Aug 10, 2020
4e2d519
fix: delay redirect on parents page for tracking call
jmif Aug 10, 2020
2cfc0fe
use i18n to show hero name in hero-select-view
Aug 11, 2020
502d9f0
feat: add trust logos to top of parents page
jmif Aug 11, 2020
6a28dde
feat: split out pricing section on parents page
jmif Aug 11, 2020
06e2978
feat: add sticky footer to parents page
jmif Aug 11, 2020
ac16b29
fix: resolve i18n issues
jmif Aug 11, 2020
e3458dd
Further fix to course-ladder loading
nwinter Aug 12, 2020
c318423
fix: remove live classes CTA click timeout
jmif Aug 12, 2020
673a608
fix: improve link click tracking and proper link URLs for direct time…
jmif Aug 12, 2020
1e83573
Tools improvement: hold down alt to get more coordinate display up to…
nwinter Aug 13, 2020
3257565
Add back/next Thang navigation links in level editor
nwinter Aug 13, 2020
77caf6d
Update zh-HANS.coffee (#5938)
smallst Aug 14, 2020
3bf811b
Fix ladder simulation exception (#5937)
smallst Aug 14, 2020
b571198
show both ogre's and human's arena code in teacher student view (#5891)
smallst Aug 14, 2020
83edca4
feat: load timetap in iframe on parents page (#5939)
jmif Aug 14, 2020
39c4300
Remove duplicate license UI for pending and empty licenses (#5936)
AndrewJakubowicz Aug 14, 2020
38dc490
fix: always show root timetap page in ModalTimetapSchedule.vue
jmif Aug 14, 2020
3ec39ce
simulate cpp ladder (#5925)
smallst Aug 15, 2020
0e8a8ad
Update uk.coffee
Bryukh Aug 16, 2020
b2534e4
Update fi.coffee (#5921)
annakau Aug 16, 2020
e4a99b3
Update de-AT.coffee (#5841)
Lukas283 Aug 16, 2020
d5989c9
first batch of Czech translations (#5810)
mgswiss15 Aug 16, 2020
7f1c378
Update uk.coffee (#5793)
comav Aug 16, 2020
051a8e3
Update ko.coffee (#5658)
JaewonLee0217 Aug 16, 2020
f28195e
Fixing korean locale (#5941)
Bryukh Aug 16, 2020
6e38c63
Merge branch 'master' into deivan-patch-1
Bryukh Aug 16, 2020
4b77198
Run copy-i18n-tags (#5942)
coco-ci Aug 17, 2020
0af453b
fix: timetap modal sizing in safari
jmif Aug 19, 2020
06d0dd0
Run copy-i18n-tags (#5944)
coco-ci Aug 21, 2020
cb4b477
Merge branch 'master' into deivan-patch-1
Bryukh Aug 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/components/common/BaseModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@
.modal-header
font-weight: bold
font-size: 30px
position: relative

.modal-body
font-size: 20px
flex-grow: 1
padding-top: 0px
</style>
36 changes: 30 additions & 6 deletions app/lib/LevelLoader.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,41 @@ module.exports = class LevelLoader extends CocoClass
@opponentSession = @opponentSessionResource.model

if @session.loaded
console.debug 'LevelLoader: session already loaded:', @session
console.debug 'LevelLoader: session already loaded:', @session if LOG
@session.setURL '/db/level.session/' + @session.id
@loadDependenciesForSession @session
else
console.debug 'LevelLoader: loading session:', @session
console.debug 'LevelLoader: loading session:', @session if LOG
@listenToOnce @session, 'sync', ->
@session.setURL '/db/level.session/' + @session.id
@loadDependenciesForSession @session
if @opponentSession
if @opponentSession.loaded
@loadDependenciesForSession @opponentSession
console.debug 'LevelLoader: opponent session already loaded:', @opponentSession if LOG
@preloadTokenForOpponentSession @opponentSession
else
@listenToOnce @opponentSession, 'sync', @loadDependenciesForSession
console.debug 'LevelLoader: loading opponent session:', @opponentSession if LOG
@listenToOnce @opponentSession, 'sync', @preloadTokenForOpponentSession

preloadTokenForOpponentSession: (session) =>
language = session.get('codeLanguage')
compressed = session.get 'interpret'
if language not in ['java', 'cpp'] or not compressed
@loadDependenciesForSession session
else
uncompressed = LZString.decompressFromUTF16 compressed
code = session.get 'code'

headers = { 'Accept': 'application/json', 'Content-Type': 'application/json' }
m = document.cookie.match(/JWT=([a-zA-Z0-9.]+)/)
service = window?.localStorage?.kodeKeeperService or "/service/parse-code"
fetch service, {method: 'POST', mode:'cors', headers:headers, body:JSON.stringify({code: uncompressed, language: language})}
.then (x) => x.json()
.then (x) =>
code[if session.get('team') is 'humans' then 'hero-placeholder' else 'hero-placeholder-1'].plan = x.token
session.set 'code', code
session.unset 'interpret'
@loadDependenciesForSession session

loadDependenciesForSession: (session) ->
console.debug "Loading dependencies for session: ", session if LOG
Expand Down Expand Up @@ -380,6 +402,7 @@ module.exports = class LevelLoader extends CocoClass
@worldNecessities.push @maybeLoadURL(url, LevelComponent, 'component')

onWorldNecessityLoaded: (resource) ->
# Note: this can also be called when session, opponentSession, or other resources with dedicated load handlers are loaded, before those handlers
index = @worldNecessities.indexOf(resource)
if resource.name is 'thang'
@loadDefaultComponentsForThangType(resource.model)
Expand All @@ -396,7 +419,7 @@ module.exports = class LevelLoader extends CocoClass

checkAllWorldNecessitiesRegisteredAndLoaded: ->
reason = @getReasonForNotYetLoaded()
console.debug('LevelLoader: Reason not loaded:', reason)
console.debug('LevelLoader: Reason not loaded:', reason) if reason and LOG
return !reason

getReasonForNotYetLoaded: ->
Expand All @@ -405,8 +428,9 @@ module.exports = class LevelLoader extends CocoClass
return 'not all session dependencies registered' if @sessionDependenciesRegistered and not @sessionDependenciesRegistered[@session.id] and not @sessionless
return 'not all opponent session dependencies registered' if @sessionDependenciesRegistered and @opponentSession and not @sessionDependenciesRegistered[@opponentSession.id] and not @sessionless
return 'session is not loaded' unless @session?.loaded or @sessionless
return 'opponent session is not loaded' if @opponentSession and not @opponentSession.loaded
return 'opponent session is not loaded' if @opponentSession and (not @opponentSession.loaded or @opponentSession.get('interpret'))
return 'have not published level loaded' unless @publishedLevelLoaded or @sessionless
return 'cpp/java token is still fetching' if @opponentSession and @opponentSession.get 'interpret'
return ''

onWorldNecessitiesLoaded: ->
Expand Down
53 changes: 43 additions & 10 deletions app/lib/simulator/Simulator.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,26 @@ module.exports = class Simulator extends CocoClass
@simulatingPlayerStrings = {}
for team in ['humans', 'ogres']
session = _.find(taskData.sessions, {team: team})
unless session
@trigger 'statusUpdate', "Error simulating game: didn't find both teams' sessions. Trying another game in #{@retryDelayInSeconds} seconds."
@simulateAnotherTaskAfterDelay()
return
@simulatingPlayerStrings[team] = "#{session.creatorName or session.creator} #{session.team}"
@trigger 'statusUpdate', "Setting up #{taskData.sessions[0].levelID} simulation between #{@simulatingPlayerStrings.humans} and #{@simulatingPlayerStrings.ogres}"
#refactor this
@task = new SimulationTask(taskData)
try
levelID = @task.getLevelName()
catch err
console.error err
@trigger 'statusUpdate', "Error simulating game: #{err}. Trying another game in #{@retryDelayInSeconds} seconds."
@simulateAnotherTaskAfterDelay()
return

@supermodel ?= new SuperModel()
@supermodel.resetProgress()
@stopListening @supermodel, 'loaded-all'
@levelLoader = new LevelLoader supermodel: @supermodel, levelID: @task.getLevelName(), sessionID: @task.getFirstSessionID(), opponentSessionID: @task.getSecondSessionID(), headless: true
@levelLoader = new LevelLoader supermodel: @supermodel, levelID: levelID, sessionID: @task.getFirstSessionID(), opponentSessionID: @task.getSecondSessionID(), headless: true

if @supermodel.finished()
@simulateSingleGame()
Expand All @@ -95,7 +106,8 @@ module.exports = class Simulator extends CocoClass
commenceSingleSimulation: ->
@listenToOnce @god, 'infinite-loop', @handleSingleSimulationInfiniteLoop
@listenToOnce @god, 'goals-calculated', @processSingleGameResults
@god.createWorld {spells: @generateSpellsObject()}
@generateSpellsObject()
.then (spell) => @god.createWorld {spells: spell}

handleSingleSimulationError: (error) ->
console.error 'There was an error simulating a single game!', error
Expand Down Expand Up @@ -253,7 +265,8 @@ module.exports = class Simulator extends CocoClass
commenceSimulationAndSetupCallback: ->
@listenToOnce @god, 'infinite-loop', @onInfiniteLoop
@listenToOnce @god, 'goals-calculated', @processResults
@god.createWorld {spells: @generateSpellsObject()}
@generateSpellsObject()
.then (spell) => @god.createWorld {spells: spell}

# Search for leaks, headless-client only.
# NOTE: Memwatch currently being ignored by Webpack, because it's only used by the server.
Expand Down Expand Up @@ -392,20 +405,40 @@ module.exports = class Simulator extends CocoClass

generateSpellsObject: ->
spells = {}
promises = []
for {hero, team} in [{hero: 'Hero Placeholder', team: 'humans'}, {hero: 'Hero Placeholder 1', team: 'ogres'}]
sessionInfo = _.filter(@task.getSessions(), {team: team})[0]
fullSpellName = _.string.slugify(hero) + '/plan'
submittedCodeLanguage = sessionInfo?.submittedCodeLanguage ? 'javascript'
submittedCodeLanguage = 'javascript' if submittedCodeLanguage in ['clojure', 'io'] # No longer supported
submittedCode = LZString.decompressFromUTF16 sessionInfo?.submittedCode?[_.string.slugify(hero)]?.plan ? ''
aether = new Aether createAetherOptions functionName: 'plan', codeLanguage: submittedCodeLanguage, skipProtectAPI: false
try
aether.transpile submittedCode
catch e
console.log "Couldn't transpile #{fullSpellName}:\n#{submittedCode}\n", e
aether.transpile ''
spells[fullSpellName] = name: 'plan', team: team, thang: {thang: {id: hero}, aether: aether}
spells
spl = name: 'plan', team: team, thang: {thang: {id: hero}, aether: aether}, fullSpellName: fullSpellName
promises.push(@fetchToken(submittedCode, submittedCodeLanguage, spl))
Promise.all(promises)
.then((values) =>
for res in values
spl = res.spell
source = res.source
fullSpellName = spl.fullSpellName
try
spl.thang.aether.transpile source
catch e
console.log "Couldn't transpile #{fullSpellName}:\n#{source}\n", e
delete spl.fullSpellName
spells[fullSpellName] = spl)
.then(() => spells)

fetchToken: (source, language, spell) =>
if language not in ['java', 'cpp'] or /^\u56E7[a-zA-Z0-9+/=]+\f$/.test source
return Promise.resolve({source: source, spell: spell})

headers = { 'Accept': 'application/json', 'Content-Type': 'application/json' }
m = document.cookie.match(/JWT=([a-zA-Z0-9.]+)/)
service = window?.localStorage?.kodeKeeperService or "/service/parse-code"
fetch service, {method: 'POST', mode:'cors', headers:headers, body:JSON.stringify({code: source, language: language})}
.then (x) => x.json()
.then (x) => {source: x.token, spell: spell}


class SimulationTask
Expand Down
15 changes: 11 additions & 4 deletions app/lib/surface/CoordinateDisplay.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,20 @@ module.exports = class CoordinateDisplay extends createjs.Container

onMouseMove: (e) ->
wop = @camera.screenToWorld x: e.x, y: e.y
wop.x = Math.round(wop.x)
wop.y = Math.round(wop.y)
if key.alt
wop.x = Math.round(wop.x * 1000) / 1000
wop.y = Math.round(wop.y * 1000) / 1000
else
wop.x = Math.round(wop.x)
wop.y = Math.round(wop.y)
return if wop.x is @lastPos?.x and wop.y is @lastPos?.y
@lastPos = wop
@lastScreenPos = x: e.x, y: e.y
@hide()
@show() # debounced
if key.alt
@performShow()
else
@hide()
@show() # debounced

onMouseDown: (e) ->
return unless key.shift
Expand Down
22 changes: 19 additions & 3 deletions app/locale/ar.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = nativeDescription: "العربية", englishDescription: "Arabic", translation:

new_home:
title: "كودكومبات - العاب برمجة لتعليم بايثون و جافا سكريبت"
meta_keywords: "كودكومبات, بايثون, جافا سكريبت, العاب برمجة"
Expand Down Expand Up @@ -90,7 +91,7 @@ module.exports = nativeDescription: "العربية", englishDescription: "Arabi
# teachers_love_codecombat_blurb2: "Would recommend CodeCombat to other computer science teachers"
# teachers_love_codecombat_blurb3: "Say that CodeCombat helps them support students’ problem solving abilities"
# teachers_love_codecombat_subblurb: "In partnership with McREL International, a leader in research-based guidance and evaluations of educational technology."
# top_banner_blurb: "New: join our mission!"
# top_banner_blurb: "Parents, book your child's first live online coding class for free!"
try_the_game: "جرب اللعبة"
classroom_edition: "إصدار الفصل الدراسي:"
learn_to_code: "تعلم البرمجة:"
Expand Down Expand Up @@ -356,7 +357,7 @@ module.exports = nativeDescription: "العربية", englishDescription: "Arabi
# complete_subscription: "Complete Subscription"
# create_student_header: "Create Student Account"
# create_teacher_header: "Create Teacher Account"
# create_individual_header: "إنشاء حساب فردي"
# create_individual_header: "Create Individual Account"
email_announcements: "تلقي الإعلانات عن طريق البريد الإلكتروني"
sign_in_to_continue: "تسجيل الدخول أو إنشاء حساب جديد للمتابعة"
# teacher_email_announcements: "Keep me updated on new teacher resources, curriculum, and courses!"
Expand Down Expand Up @@ -788,6 +789,14 @@ module.exports = nativeDescription: "العربية", englishDescription: "Arabi
# content: "Amazing! We just launched live online classes."
# link: "Ready to get ahead on your coding?"

# code_quest:
# great: "Great!"
# join_paragraph: "Join the largest international Python AI coding tournament for all ages and compete for the top of the leaderboard! This month-long global battle starts August 1st and includes $5k worth of prizes and a virtual awards ceremony where we'll announce winners and recognize your coding skills."
# link: "Click here to register and learn more"
# global_tournament: "Global Tournament"
# register: "Register"
# date: "Aug 1 - Aug 31"

# play_game_dev_level:
# created_by: "Created by {{name}}"
# created_during_hoc: "Created during Hour of Code"
Expand All @@ -805,7 +814,7 @@ module.exports = nativeDescription: "العربية", englishDescription: "Arabi

game_menu:
inventory_tab: "المخزن"
save_load_tab: "أحفظ\أسترجع"
save_load_tab: "أحفظأسترجع"
options_tab: "خيارات"
guide_tab: "الدليل"
guide_video_tutorial: "فيديو تعليمي"
Expand Down Expand Up @@ -2973,12 +2982,18 @@ module.exports = nativeDescription: "العربية", englishDescription: "Arabi
# small_group_classes_detail_3: "Build projects and give feedback to other students"
# small_group_classes_detail_4: "Screen sharing to get live feedback on coding and debugging"
# private_classes: "Private Coding Classes"
# four_sessions_per_month: "4 Private Sessions / Mo."
# eight_sessions_per_month: "8 Private Sessions / Mo."
# four_private_classes_price: "$219/mo"
# eight_private_classes_price: "$399/mo"
# private_classes_detail: "4 or 8 Private Sessions / Mo."
# private_classes_price: "$219/mo or $399/mo"
# private_classes_detail_1: "1:1 student to instructor ratio"
# private_classes_detail_2: "60 minute classes"
# private_classes_detail_3: "Flexible schedule tailored to your needs"
# private_classes_detail_4: "Lesson plans and live feedback tailored to students' learning style, pace, and ability level"
# best_seller: "Best Seller"
# best_value: "Best Value"
# codecombat_premium: "CodeCombat Premium"
# monthly_sub: "Monthly Subscription"
# buy_now: "Buy now"
Expand Down Expand Up @@ -3045,6 +3060,7 @@ module.exports = nativeDescription: "العربية", englishDescription: "Arabi
# start_free_trial_today: "Start free trial today"
# live_classes_title: "Live coding classes from CodeCombat!"
# live_class_booked_thank_you: "Your live class has been booked, thank you!"
# book_your_class: "Book Your Class"

# parent_modal:
# refer_teacher: "Refer Teacher"
Expand Down
17 changes: 16 additions & 1 deletion app/locale/az.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ module.exports = nativeDescription: "azərbaycan dili", englishDescription: "Aze
# teachers_love_codecombat_blurb2: "Would recommend CodeCombat to other computer science teachers"
# teachers_love_codecombat_blurb3: "Say that CodeCombat helps them support students’ problem solving abilities"
# teachers_love_codecombat_subblurb: "In partnership with McREL International, a leader in research-based guidance and evaluations of educational technology."
# top_banner_blurb: "New: join our mission!"
# top_banner_blurb: "Parents, book your child's first live online coding class for free!"
# try_the_game: "Try the game"
classroom_edition: "Sinif Nəşri:"
learn_to_code: "Kodlaşdırmağı öyrən:"
Expand Down Expand Up @@ -789,6 +789,14 @@ module.exports = nativeDescription: "azərbaycan dili", englishDescription: "Aze
# content: "Amazing! We just launched live online classes."
# link: "Ready to get ahead on your coding?"

# code_quest:
# great: "Great!"
# join_paragraph: "Join the largest international Python AI coding tournament for all ages and compete for the top of the leaderboard! This month-long global battle starts August 1st and includes $5k worth of prizes and a virtual awards ceremony where we'll announce winners and recognize your coding skills."
# link: "Click here to register and learn more"
# global_tournament: "Global Tournament"
# register: "Register"
# date: "Aug 1 - Aug 31"

# play_game_dev_level:
# created_by: "Created by {{name}}"
# created_during_hoc: "Created during Hour of Code"
Expand Down Expand Up @@ -2974,12 +2982,18 @@ module.exports = nativeDescription: "azərbaycan dili", englishDescription: "Aze
# small_group_classes_detail_3: "Build projects and give feedback to other students"
# small_group_classes_detail_4: "Screen sharing to get live feedback on coding and debugging"
# private_classes: "Private Coding Classes"
# four_sessions_per_month: "4 Private Sessions / Mo."
# eight_sessions_per_month: "8 Private Sessions / Mo."
# four_private_classes_price: "$219/mo"
# eight_private_classes_price: "$399/mo"
# private_classes_detail: "4 or 8 Private Sessions / Mo."
# private_classes_price: "$219/mo or $399/mo"
# private_classes_detail_1: "1:1 student to instructor ratio"
# private_classes_detail_2: "60 minute classes"
# private_classes_detail_3: "Flexible schedule tailored to your needs"
# private_classes_detail_4: "Lesson plans and live feedback tailored to students' learning style, pace, and ability level"
# best_seller: "Best Seller"
# best_value: "Best Value"
# codecombat_premium: "CodeCombat Premium"
# monthly_sub: "Monthly Subscription"
# buy_now: "Buy now"
Expand Down Expand Up @@ -3046,6 +3060,7 @@ module.exports = nativeDescription: "azərbaycan dili", englishDescription: "Aze
# start_free_trial_today: "Start free trial today"
# live_classes_title: "Live coding classes from CodeCombat!"
# live_class_booked_thank_you: "Your live class has been booked, thank you!"
# book_your_class: "Book Your Class"

# parent_modal:
# refer_teacher: "Refer Teacher"
Expand Down
Loading