mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Remove transpiledCode and screenshot from LevelSession
This commit is contained in:
parent
f5c9be4831
commit
8c48e4fc14
8 changed files with 5 additions and 93 deletions
|
@ -62,9 +62,6 @@ _.extend LevelSessionSchema.properties,
|
|||
team: c.shortString()
|
||||
level: LevelSessionLevelSchema
|
||||
|
||||
screenshot:
|
||||
type: 'string'
|
||||
|
||||
heroConfig: c.HeroConfigSchema
|
||||
|
||||
state: c.object {},
|
||||
|
@ -208,14 +205,6 @@ _.extend LevelSessionSchema.properties,
|
|||
submittedCodeLanguage:
|
||||
type: 'string'
|
||||
|
||||
transpiledCode:
|
||||
type: 'object'
|
||||
additionalProperties:
|
||||
type: 'object'
|
||||
additionalProperties:
|
||||
type: 'string'
|
||||
format: 'code'
|
||||
|
||||
isRanking:
|
||||
type: 'boolean'
|
||||
description: 'Whether this session is still in the first ranking chain after being submitted.'
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
#admin-level-sessions-view
|
||||
.session_tile
|
||||
display: inline-block
|
||||
position: relative
|
||||
margin: 8px
|
||||
|
||||
.session_info
|
||||
position: absolute
|
||||
top: 0
|
||||
left: 0
|
||||
right: 0
|
||||
text-align: center
|
||||
background: rgba(0, 0, 0, 0.5)
|
||||
color: white
|
|
@ -30,8 +30,6 @@ block content
|
|||
h4 Entities
|
||||
|
||||
ul
|
||||
li
|
||||
a(href="/admin/level-sessions") Active Instances
|
||||
li
|
||||
a(href="/admin/trial-requests") Trial Requests
|
||||
li
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
extends /templates/base
|
||||
|
||||
block content
|
||||
|
||||
h1 Latest Games
|
||||
|
||||
each session in view.sessions.models
|
||||
- var url = '/play/level/'+session.get('levelID')+'?session='+session.id
|
||||
.session_tile
|
||||
a(href=url)
|
||||
if session.get('screenshot')
|
||||
img(src=session.get('screenshot'))
|
||||
else
|
||||
img(src="/images/generic-icon.png")
|
||||
.session_info
|
||||
.level_name= session.get('levelName')
|
||||
.creator_name= session.get('creatorName')
|
|
@ -1,19 +0,0 @@
|
|||
RootView = require 'views/core/RootView'
|
||||
template = require 'templates/admin/level_sessions'
|
||||
LevelSession = require 'models/LevelSession'
|
||||
CocoCollection = require 'collections/CocoCollection'
|
||||
|
||||
class LevelSessionCollection extends CocoCollection
|
||||
url: '/db/level.session/x/active?project=screenshot,levelName,creatorName'
|
||||
model: LevelSession
|
||||
|
||||
module.exports = class LevelSessionsView extends RootView
|
||||
id: 'admin-level-sessions-view'
|
||||
template: template
|
||||
|
||||
constructor: (options) ->
|
||||
super options
|
||||
@getLevelSessions()
|
||||
|
||||
getLevelSessions: ->
|
||||
@sessions = @supermodel.loadCollection(new LevelSessionCollection(), 'sessions', {cache: false}).model
|
|
@ -69,7 +69,6 @@ module.exports = class PlayLevelView extends RootView
|
|||
'god:infinite-loop': 'onInfiniteLoop'
|
||||
'level:reload-from-data': 'onLevelReloadFromData'
|
||||
'level:reload-thang-type': 'onLevelReloadThangType'
|
||||
'level:session-will-save': 'onSessionWillSave'
|
||||
'level:started': 'onLevelStarted'
|
||||
'level:loading-view-unveiling': 'onLoadingViewUnveiling'
|
||||
'level:loading-view-unveiled': 'onLoadingViewUnveiled'
|
||||
|
@ -112,7 +111,6 @@ module.exports = class PlayLevelView extends RootView
|
|||
@gameUIState = new GameUIState()
|
||||
|
||||
$(window).on 'resize', @onWindowResize
|
||||
@saveScreenshot = _.throttle @saveScreenshot, 30000
|
||||
|
||||
application.tracker?.enableInspectletJS(@levelID)
|
||||
|
||||
|
@ -594,15 +592,6 @@ module.exports = class PlayLevelView extends RootView
|
|||
@bus.removeFirebaseData =>
|
||||
@bus.disconnect()
|
||||
|
||||
onSessionWillSave: (e) ->
|
||||
# Something interesting has happened, so (at a lower frequency), we'll save a screenshot.
|
||||
#@saveScreenshot e.session
|
||||
|
||||
# Throttled
|
||||
saveScreenshot: (session) =>
|
||||
return unless screenshot = @surface?.screenshot()
|
||||
session.save {screenshot: screenshot}, {patch: true, type: 'PUT'}
|
||||
|
||||
onContactClicked: (e) ->
|
||||
Backbone.Mediator.publish 'level:contact-button-pressed', {}
|
||||
@openModalView contactModal = new ContactModal levelID: @level.get('slug') or @level.id, courseID: @courseID, courseInstanceID: @courseInstanceID
|
||||
|
@ -954,20 +943,6 @@ module.exports = class PlayLevelView extends RootView
|
|||
console.error 'Failed to read sessionState in onRealTimeMultiplayerCast'
|
||||
|
||||
console.info 'Submitting my code'
|
||||
# Transpiling code copied from scripts/transpile.coffee
|
||||
# TODO: Should this live somewhere else?
|
||||
transpiledCode = {}
|
||||
for thang, spells of @session.get('code')
|
||||
transpiledCode[thang] = {}
|
||||
for spellID, spell of spells
|
||||
spellName = thang + '/' + spellID
|
||||
continue if @session.get('teamSpells') and not (spellName in @session.get('teamSpells')[@session.get('team')])
|
||||
# console.log "PlayLevelView Transpiling spell #{spellName}"
|
||||
aetherOptions = createAetherOptions functionName: spellID, codeLanguage: @session.get('submittedCodeLanguage'), includeFlow: true
|
||||
aether = new Aether aetherOptions
|
||||
transpiledCode[thang][spellID] = aether.transpile spell
|
||||
# console.log "PlayLevelView transpiled code", transpiledCode
|
||||
@session.set 'transpiledCode', transpiledCode
|
||||
permissions = @session.get 'permissions' ? []
|
||||
unless _.find(permissions, (p) -> p.target is 'public' and p.access is 'read')
|
||||
permissions.push target:'public', access:'read'
|
||||
|
|
|
@ -195,7 +195,7 @@ LevelHandler = class LevelHandler extends Handler
|
|||
majorVersion: level.version.major
|
||||
creator: req.user._id+''
|
||||
|
||||
query = Session.find(sessionQuery).select('-screenshot -transpiledCode')
|
||||
query = Session.find(sessionQuery)
|
||||
# TODO: take out "code" as well, since that can get huge containing the transpiled code for the lat hero, and find another way of having the LadderSubmissionViews in the MyMatchesTab determine ranking readiness
|
||||
query.exec (err, results) =>
|
||||
if err then @sendDatabaseError(res, err) else @sendSuccess res, results
|
||||
|
|
|
@ -84,9 +84,9 @@ LevelSessionSchema.pre 'save', (next) ->
|
|||
|
||||
LevelSessionSchema.statics.privateProperties = ['code', 'submittedCode', 'unsubscribed']
|
||||
LevelSessionSchema.statics.editableProperties = ['multiplayer', 'players', 'code', 'codeLanguage', 'completed', 'state',
|
||||
'levelName', 'creatorName', 'levelID', 'screenshot',
|
||||
'levelName', 'creatorName', 'levelID',
|
||||
'chat', 'teamSpells', 'submitted', 'submittedCodeLanguage',
|
||||
'unsubscribed', 'playtime', 'heroConfig', 'team', 'transpiledCode',
|
||||
'unsubscribed', 'playtime', 'heroConfig', 'team',
|
||||
'browser']
|
||||
LevelSessionSchema.statics.jsonSchema = jsonschema
|
||||
|
||||
|
|
Loading…
Reference in a new issue