2016-04-07 22:06:57 -04:00
|
|
|
RootView = require 'views/core/RootView'
|
|
|
|
template = require 'templates/editor/verifier/verifier-view'
|
|
|
|
VerifierTest = require './VerifierTest'
|
|
|
|
|
|
|
|
module.exports = class VerifierView extends RootView
|
|
|
|
className: 'style-flat'
|
|
|
|
template: template
|
|
|
|
id: 'verifier-view'
|
|
|
|
|
|
|
|
constructor: (options, @levelID) ->
|
|
|
|
super options
|
|
|
|
# TODO: rework to handle N at a time instead of all at once
|
|
|
|
# TODO: sort tests by unexpected result first
|
2016-05-03 14:46:10 -04:00
|
|
|
@passed = 0
|
|
|
|
@failed = 0
|
2016-05-03 15:14:51 -04:00
|
|
|
testLevels = [
|
|
|
|
'dungeons-of-kithgard', 'gems-in-the-deep', 'shadow-guard', 'kounter-kithwise', 'crawlways-of-kithgard',
|
|
|
|
'enemy-mine', 'illusory-interruption', 'forgetful-gemsmith', 'signs-and-portents', 'favorable-odds',
|
|
|
|
'true-names', 'the-prisoner', 'banefire', 'the-raised-sword', 'kithgard-librarian', 'fire-dancing',
|
|
|
|
'loop-da-loop', 'haunted-kithmaze', 'riddling-kithmaze', 'descending-further', 'the-second-kithmaze',
|
|
|
|
'dread-door', 'cupboards-of-kithgard', 'hack-and-dash', 'known-enemy', 'master-of-names', 'lowly-kithmen',
|
|
|
|
'closing-the-distance', 'tactical-strike', 'the-skeleton', 'a-mayhem-of-munchkins', 'the-final-kithmaze',
|
2016-05-03 17:36:27 -04:00
|
|
|
'the-gauntlet', 'radiant-aura', 'kithgard-gates', 'destroying-angel', 'deadly-dungeon-rescue',
|
|
|
|
'breakout', 'attack-wisely', 'kithgard-mastery', 'kithgard-apprentice', 'robot-ragnarok',
|
|
|
|
'defense-of-plainswood', 'peasant-protection', 'forest-fire-dancing', 'course-winding-trail',
|
2016-05-03 15:14:51 -04:00
|
|
|
'patrol-buster', 'endangered-burl', 'thumb-biter', 'gems-or-death', 'village-guard', 'thornbush-farm',
|
|
|
|
'back-to-back', 'ogre-encampment', 'woodland-cleaver', 'shield-rush', 'range-finder', 'munchkin-swarm',
|
|
|
|
'stillness-in-motion', 'the-agrippa-defense', 'backwoods-bombardier', 'coinucopia', 'copper-meadows',
|
2016-05-03 18:15:44 -04:00
|
|
|
'drop-the-flag', 'mind-the-trap', 'signal-corpse', 'rich-forager'
|
2016-05-03 15:14:51 -04:00
|
|
|
]
|
|
|
|
|
2016-04-07 22:06:57 -04:00
|
|
|
#testLevels = testLevels.slice 0, 15
|
2016-05-03 15:14:51 -04:00
|
|
|
@linksQueryString = window.location.search
|
2016-05-03 14:46:10 -04:00
|
|
|
@levelIDs = if @levelID then [@levelID] else testLevels
|
|
|
|
@testCount = @levelIDs.length * 2 #One per langauge
|
2016-04-07 22:06:57 -04:00
|
|
|
#supermodel = if @levelID then @supermodel else undefined
|
|
|
|
@tests = []
|
2016-05-03 14:46:10 -04:00
|
|
|
async.eachSeries @levelIDs, (levelID, lnext) =>
|
2016-04-07 22:06:57 -04:00
|
|
|
async.eachSeries ['python','javascript'], (lang, next) =>
|
2016-05-03 14:46:10 -04:00
|
|
|
test = new VerifierTest levelID, (e) =>
|
|
|
|
|
2016-04-07 22:06:57 -04:00
|
|
|
@update(e)
|
2016-05-03 14:46:10 -04:00
|
|
|
if e.state in ['complete', 'error']
|
|
|
|
if test.isSucessful()
|
|
|
|
++@passed
|
|
|
|
else
|
|
|
|
++@failed
|
|
|
|
next()
|
2016-04-07 22:06:57 -04:00
|
|
|
, @supermodel, lang
|
2016-05-03 14:46:10 -04:00
|
|
|
@tests.unshift test
|
2016-04-07 22:06:57 -04:00
|
|
|
, -> lnext()
|
2016-05-03 14:46:10 -04:00
|
|
|
, () => @render()
|
2016-04-07 22:06:57 -04:00
|
|
|
update: (event) =>
|
|
|
|
# TODO: show unworkable tests instead of hiding them
|
|
|
|
# TODO: destroy them Tests after or something
|
2016-05-03 14:46:10 -04:00
|
|
|
@render()
|