Fix filename convention, improve solution checker, remove old files

This commit is contained in:
Josh Callebaut 2016-05-10 14:34:17 -07:00
parent 30c879ddc0
commit 19e1c808d8
18 changed files with 43 additions and 121 deletions

View file

@ -1,12 +0,0 @@
#thang-tasks-view
#thangTable
width: 100%
.tasksTable
width: 100%
.tasks
width: 87.5%
.taskOwner
width: 12.5%

View file

@ -27,7 +27,7 @@ mixin levelRow(level)
td.taskOwner
a(href= 'level/' + level.slug)= level.name
td.tasks
table.table-striped.table-hover.tasksTable
table.table-condensed.table-striped.table-hover.tasksTable
for task in (level.tasks2 || [])
if !task.complete
tr

View file

@ -8,7 +8,7 @@ block content
tr
td(style="width:10%")= level.level.get('slug')
td
table.table-striped
table.table-condensed.table-striped.table-hover
for problem in (level.problems || [])
tr(style="width:100%")
td.problemType= problem.type

View file

@ -1,29 +0,0 @@
extends /templates/base
block content
#thang-tasks-view
input#nameSearch(placeholder='Filter: Thang Name')
br
input#descSearch(placeholder='Filter: Task Description')
hr
if view.processedThangs
table.table.table-striped#thangTable
tr
th Thang Name
th Task List
for thang in view.processedThangs
if view.hasIncompleteTasks(thang)
+thangRow(thang)
else
span No view.processedThangs
mixin thangRow(thang)
tr
td.taskOwner
a(href= 'thang/' + thang.get('slug'))= thang.get('name')
td.tasks
table.table-striped.table-hover.tasksTable
for task in (thang.tasks || [])
if !task.complete
tr
td= task.name

View file

@ -1,8 +1,6 @@
RootView = require 'views/core/RootView'
template = require 'templates/artisans/artisansView'
template = require 'templates/artisans/artisans-view'
module.exports = class ArtisansView extends RootView
template: template
id: 'artisans-view'
constructor: (options) ->
super options

View file

@ -1,5 +1,5 @@
RootView = require 'views/core/RootView'
template = require 'templates/artisans/courseGearView'
template = require 'templates/artisans/course-gear-view'
Level = require 'models/Level'
Campaign = require 'models/Campaign'
Level = require 'models/Level'
@ -13,4 +13,4 @@ module.exports = class CourseGearView extends RootView
url: '/db/campaign?project=slug'
model: Campaign
)
@supermodel.trackRequest(@campaigns.fetch())
@supermodel.trackRequest(@campaigns.fetch(), @do )

View file

@ -1,5 +1,5 @@
RootView = require 'views/core/RootView'
template = require 'templates/artisans/levelTasksView'
template = require 'templates/artisans/level-tasks-view'
#ThangType = require 'models/ThangType'
Level = require 'models/Level'
Campaign = require 'models/Campaign'

View file

@ -1,5 +1,5 @@
RootView = require 'views/core/RootView'
template = require 'templates/artisans/solutionProblemsView'
template = require 'templates/artisans/solution-problems-view'
Level = require 'models/Level'
Campaign = require 'models/Campaign'
Level = require 'models/Level'
@ -12,22 +12,22 @@ module.exports = class SolutionProblemsView extends RootView
"picoctf"
"auditions"
#"dungeon"
#"forest"
#"desert"
"dungeon"
"forest"
"desert"
#"mountain"
#"glacier"
"glacier"
"dungeon-branching-test"
"forest-branching-test"
"desert-branching-test"
#"intro"
#"course-2"
#"course-3"
#"course-4"
#"course-5"
#"course-6"
"intro"
"course-2"
"course-3"
"course-4"
"course-5"
"course-6"
]
excludedSimulationLevels = [
# Course Arenas
@ -52,6 +52,7 @@ module.exports = class SolutionProblemsView extends RootView
isReady: 0
requiresSubs: 0
rob: []
test2: []
constructor: (options) ->
super options
@campaigns = new CocoCollection([],
@ -77,15 +78,16 @@ module.exports = class SolutionProblemsView extends RootView
@loadedLevels = {}
count = 0
for campaign in @campaigns.models
continue unless excludedCampaigns.indexOf(campaign.get 'slug') is -1
campaignSlug = campaign.get('slug')
continue unless excludedCampaigns.indexOf(campaignSlug) is -1
count++
@test[campaign.get('slug')] = new CocoCollection([],
url: '/db/campaign/' + campaign.get('slug') + '/levels?project=thangs,slug,requiresSubscription'
@test[campaignSlug] = new CocoCollection([],
url: '/db/campaign/' + campaignSlug + '/levels?project=thangs,slug,requiresSubscription,campaign'
model: Level
)
@test[campaign.get('slug')].fetch()
@listenTo(@test[campaign.get('slug')], 'sync', (e) ->
#@loadedLevels = _uniq(_.union(@loadedLevels, e.models))
@test[campaignSlug].fetch()
@listenTo(@test[campaignSlug], 'sync', (e) ->
e.models.reverse()
for level in e.models
if not @loadedLevels[level.get('slug')]? and level.get('requiresSubscription')
@requiresSubs++
@ -94,7 +96,7 @@ module.exports = class SolutionProblemsView extends RootView
if count is 0
@readyUp()
)
@supermodel.loadCollection(@test[campaign.get('slug')], 'levels')
@supermodel.loadCollection(@test[campaignSlug], 'levels')
readyUp: ->
console.log("Count of levels: " + _.size(@loadedLevels))
@ -134,14 +136,17 @@ module.exports = class SolutionProblemsView extends RootView
problems = []
if excludedSolutionLevels.indexOf(levelSlug) is -1
for lang in ["python", "javascript", "lua", "java"]
for lang in ["python", "javascript", "lua", "java", "coffeescript"]
if _.findWhere(solutions, (elem) -> return elem.language is lang)
@rob.push language: lang, level: levelSlug
else if lang not in ["lua", "java"]
#@rob.push language: lang, level: levelSlug
else if lang not in ["lua", "java", "coffeescript"]
problems.push {
"type":"Missing Solution Language",
"value":lang
}
@test2.push(levelSlug)
#break
@problemCount++
else
# monitor lua/java when we care about it here
@ -149,6 +154,7 @@ module.exports = class SolutionProblemsView extends RootView
for solutionIndex of solutions
solution = solutions[solutionIndex]
if excludedSimulationLevels.indexOf(levelSlug) is -1
isSimul = true
for req in ["seed", "succeeds", "heroConfig", 'frameCount', 'goals'] # Implement a fix for lastHash
unless solution[req]?
console.log levelSlug, req
@ -157,14 +163,20 @@ module.exports = class SolutionProblemsView extends RootView
"value":solution.language
}
@problemCount++
isSimul = false
break
if solution.source.indexOf("pass") isnt -1
if isSimul
console.log level.get('campaign')
if @rob.indexOf(levelSlug) is -1
@rob.push(levelSlug)
if solution.source.search(/pass\n/i) isnt -1
problems.push {
"type":"Solution contains pass",
"value":solution.language
}
@problemCount++
if solution.source.indexOf("<%=") is -1
if solution.source.indexOf('<%=') is -1
problems.push {
"type":"Solution is not i18n'd",
"value":solution.language
@ -186,6 +198,7 @@ module.exports = class SolutionProblemsView extends RootView
"value":solution.language
}
@problemCount++
@parsedLevels.push {
level: level
problems: problems

View file

@ -1,5 +1,5 @@
RootView = require 'views/core/RootView'
template = require 'templates/artisans/thangTasksView'
template = require 'templates/artisans/thang-tasks-view'
ThangType = require 'models/ThangType'
CocoCollection = require 'collections/CocoCollection'

View file

@ -1,48 +0,0 @@
RootView = require 'views/core/RootView'
template = require 'templates/editor/thangTasksView'
ThangType = require 'models/ThangType'
CocoCollection = require 'collections/CocoCollection'
module.exports = class ThangTasksView extends RootView
template: template
id: 'thang-tasks-view'
events:
'input input': 'searchUpdate'
'change input': 'searchUpdate'
constructor: (options) ->
super options
@thangs = new CocoCollection([],
url: '/db/thang.type?project=name,tasks,slug'
model: ThangType
comparator: @sortThangs
)
@lastLoad = (new Date()).getTime()
@listenTo(@thangs, 'sync', @onThangsLoaded)
@supermodel.loadCollection(@thangs, 'thangs')
searchUpdate: ->
if not @lastLoad? or (new Date()).getTime() - @lastLoad > 60 * 1000 * 1 # Update only after a minute from last update.
@thangs.fetch()
@listenTo(@thangs, 'sync', @onThangsLoaded)
@supermodel.loadCollection(@thangs, 'thangs')
@lastLoad = (new Date()).getTime()
else
@onThangsLoaded()
onThangsLoaded: ->
@processedThangs = @thangs.filter (_elem) ->
# Case-insensitive search of input vs name.
return ///#{$('#nameSearch')[0].value}///i.test _elem.get('name')
for thang in @processedThangs
thang.tasks = _.filter thang.attributes.tasks, (_elem) ->
# Similar case-insensitive search of input vs description (name).
return ///#{$('#descSearch')[0].value}///i.test _elem.name
@renderSelectors '#thangTable'
sortThangs: (a, b) ->
a.get('name').localeCompare(b.get('name'))
# Jade helper
hasIncompleteTasks: (thang) ->
return thang.tasks and thang.tasks.filter((_elem) -> return not _elem.complete).length > 0