From 19ae7aa76ca9f7662b5a1837577e9073ab70a8e0 Mon Sep 17 00:00:00 2001 From: Thomas FORGIONE Date: Mon, 20 Jul 2015 14:41:59 +0200 Subject: [PATCH] Added 8 among many coins functionnality --- controllers/prototype/dbrequests.js | 34 +++++++- js/Makefile | 1 + js/l3d/apps/prototype/GlobalFunctions.js | 2 +- js/l3d/apps/prototype/replay/main.js | 21 +++-- js/l3d/src/cameras/ReplayCamera.js | 29 ++++--- js/l3d/src/scenes/createCoins.js | 1 + js/l3d/src/scenes/initScene.js | 103 +++++++++++++---------- sql/backup.pgsql | 60 +++++++------ 8 files changed, 157 insertions(+), 94 deletions(-) create mode 100644 js/l3d/src/scenes/createCoins.js diff --git a/controllers/prototype/dbrequests.js b/controllers/prototype/dbrequests.js index 1de7c68..c613386 100644 --- a/controllers/prototype/dbrequests.js +++ b/controllers/prototype/dbrequests.js @@ -13,9 +13,11 @@ var Info = function(id, finishAction) { previousNext: false, hovered: false, pointerLocked: false, - switchedLockOption: false + switchedLockOption: false, + redCoins: false }; + this.redCoins = []; this.results = {}; this.finishAction = finishAction; @@ -37,6 +39,7 @@ Info.prototype.execute = function() { this.loadHovered(); this.loadSwitchedLockOption(); this.loadPointerLocked(); + this.loadRedCoins(); }; Info.prototype.tryMerge = function() { @@ -58,7 +61,7 @@ Info.prototype.tryMerge = function() { // Merges the results of every SQL requests done by the load... methods Info.prototype.merge = function() { - this.finalResult = []; + this.finalResult = {redCoins : [], events : []}; for (;;) { // Find next element @@ -79,7 +82,12 @@ Info.prototype.merge = function() { } // Add the next element in results and shift its table - this.finalResult.push(this.results[nextIndex].shift()); + this.finalResult.events.push(this.results[nextIndex].shift()); + } + + // Set red coins + for (var i = 0; i < this.redCoins.length; i++) { + this.finalResult.redCoins.push(this.redCoins[i]); } }; @@ -324,6 +332,26 @@ Info.prototype.loadSwitchedLockOption = function() { ); }; +Info.prototype.loadRedCoins = function() { + var self = this; + this.client.query( + "SELECT coin_id FROM coin WHERE exp_id = $1", + [self.id], + function(err, result) { + if (err !== null) { + Log.dberror(err + ' in loadRedCoins'); + } else { + console.log(result.rows); + for (var i in result.rows) { + self.redCoins.push(result.rows[i].coin_id); + } + } + self.ready.redCoins = true; + self.tryMerge(); + } + ); +} + var UserCreator = function(finishAction) { this.finishAction = finishAction; diff --git a/js/Makefile b/js/Makefile index 869e329..04c938e 100644 --- a/js/Makefile +++ b/js/Makefile @@ -30,6 +30,7 @@ L3D: --js l3d/src/cameras/Camera.js \ --js l3d/src/cameras/FixedCamera.js \ --js l3d/src/cameras/PointerCamera.js \ + --js l3d/src/scenes/createCoins.js \ --js l3d/src/scenes/initScene.js \ --js_output_file ../static/js/l3d.min.js diff --git a/js/l3d/apps/prototype/GlobalFunctions.js b/js/l3d/apps/prototype/GlobalFunctions.js index 32178fe..7e4fa53 100644 --- a/js/l3d/apps/prototype/GlobalFunctions.js +++ b/js/l3d/apps/prototype/GlobalFunctions.js @@ -94,7 +94,7 @@ function objectClickerOnClick(camera1, buttonManager, recommendations, coins) { // Send event to DB event = new L3D.DB.Event.CoinClicked(); - event.coin_id = coins.indexOf(obj); + event.coin_id = obj.id; event.send(); } else if (obj instanceof L3D.BaseRecommendation) { diff --git a/js/l3d/apps/prototype/replay/main.js b/js/l3d/apps/prototype/replay/main.js index 648dae7..00381d5 100644 --- a/js/l3d/apps/prototype/replay/main.js +++ b/js/l3d/apps/prototype/replay/main.js @@ -18,11 +18,18 @@ function main() { container = document.getElementById('container'); initThreeElements(); - init(); - onWindowResize(); + var xhr = new XMLHttpRequest(); + xhr.open("GET", "/prototype/replay_info/" + params.get.id, true); - setInterval(render, 20); + xhr.onreadystatechange = function() { + if (xhr.readyState == 4 && xhr.status == 200) { + init(JSON.parse(xhr.responseText)); + onWindowResize(); + setInterval(render, 20); + } + }; + xhr.send(); } @@ -34,7 +41,7 @@ function initThreeElements() { } -function init() { +function init(data) { // Initialize stats counter stats = new Stats(); @@ -48,10 +55,12 @@ function init() { container.appendChild(renderer.domElement); // Initialize replay camera - camera1 = new L3D.ReplayCamera(50, container_size.width() / container_size.height(), 0.01, 100000, coins); - recommendations = initMainScene(camera1, scene, coins); + camera1 = new L3D.ReplayCamera(50, container_size.width()/container_size.height(), 0.01, 100000, coins, data); + recommendations = initMainScene(camera1, scene, coins, undefined, data.redCoins); camera1.cameras = recommendations; + camera1.start(); + // Add listeners initListeners(); diff --git a/js/l3d/src/cameras/ReplayCamera.js b/js/l3d/src/cameras/ReplayCamera.js index 26c3839..0b60144 100644 --- a/js/l3d/src/cameras/ReplayCamera.js +++ b/js/l3d/src/cameras/ReplayCamera.js @@ -12,20 +12,10 @@ L3D.ReplayCamera = function() { this.new_position = new THREE.Vector3(); this.new_target = new THREE.Vector3(); - var id = params.get.id; + this.data = arguments[5]; - var xhr = new XMLHttpRequest(); - xhr.open("GET", "/prototype/replay_info/" + id, true); - - var self = this; - xhr.onreadystatechange = function() { - if (xhr.readyState == 4 && xhr.status == 200) { - self.path = JSON.parse(xhr.responseText); - self.started = true; - self.nextEvent(); - } - }; - xhr.send(); + this.started = true; + this.path = this.data.events; // Set Position this.theta = Math.PI; @@ -39,6 +29,12 @@ L3D.ReplayCamera.prototype.look = function() { this.lookAt(this.target); }; +L3D.ReplayCamera.prototype.start = function() { + this.counter = 0; + this.started = true; + this.nextEvent(); +} + // Update function L3D.ReplayCamera.prototype.update = function(time) { if (this.started) { @@ -106,7 +102,11 @@ L3D.ReplayCamera.prototype.nextEvent = function() { if (this.event.type == 'camera') { this.move(this.event); } else if (this.event.type == 'coin') { - this.coins[this.event.id].get(); + // Get the coin with the same id of event + for (var i = 0; i < this.coins.length; i++) { + if (this.coins[i].id === this.event.id) + this.coins[i].get(); + } // Wait a little before launching nextEvent (function(self) { setTimeout(function() { @@ -167,6 +167,7 @@ L3D.ReplayCamera.prototype.anglesFromVectors = function() { L3D.ReplayCamera.prototype.move = function(recommendation) { + console.log(this.position.x, this.position.y, this.position.z); var otherCamera = recommendation.camera || recommendation; this.moving = true; diff --git a/js/l3d/src/scenes/createCoins.js b/js/l3d/src/scenes/createCoins.js new file mode 100644 index 0000000..706fa9c --- /dev/null +++ b/js/l3d/src/scenes/createCoins.js @@ -0,0 +1 @@ +L3D.createBobombCoins = function() { return [{coin:new Coin(22.280706560196638,13.725108184127997,32.63987169581496), id:0},{coin:new Coin(33.68386996752998,9.149049511822032,-18.87096639845466), id:1},{coin:new Coin(33.31162234976524,12.32414579919045,-6.836946838344371), id:2},{coin:new Coin(-6.542226291552578,12.307520787648738,-3.8865111962674517), id:3},{coin:new Coin(-17.588830805070085,23.841405751686263,-15.642444636400247), id:4},{coin:new Coin(-24.3381283859254,23.146296197160247,5.94668262444435), id:5},{coin:new Coin(-28.08790862463989,23.535010121780253,9.705135663221972), id:6},{coin:new Coin(-29.379335879791288,29.636026393280783,19.362115621994782), id:7},{coin:new Coin(-8.706913128046958,21.207848302770593,27.483816887890935), id:8},{coin:new Coin(-24.72548063753392,20.591109464902217,34.0541482945568), id:9},{coin:new Coin(6.07341534686721,12.796185940101592,17.78236645564636), id:10},{coin:new Coin(1.3769013661958112,13.438915583917735,26.790071227243793), id:11},{coin:new Coin(-1.1822337085425594,8.418877442833525,-24.963898514897572), id:12},{coin:new Coin(4.357016920017262,8.472802125274415,-30.529199236505924), id:13},{coin:new Coin(7.075416030408761,11.236188008723378,-28.279153104743983), id:14},{coin:new Coin(-17.85785378833318,13.42081721395066,-32.92376411375154), id:15},{coin:new Coin(-21.894165638010683,11.814166555266736,-5.255205616513877), id:16},{coin:new Coin(-36.585502580792195,12.88813264657535,6.356283347349125), id:17},{coin:new Coin(-17.22580655861263,23.787648282246952,-10.519501738826268), id:18},{coin:new Coin(-11.658290156106773,14.96199347508685,5.941345304662627), id:19},{coin:new Coin(-25.78117011943424,26.43994174870813,30.057819724644368), id:20},{coin:new Coin(-37.46335021251167,18.01317284378782,8.350450287883726), id:21},{coin:new Coin(30.641812668973245,13.456701531305129,8.78531092401407), id:22}];};L3D.createMountainCoins = function() { return [{coin:new Coin(-26.77972359627476,-19.23929063656664,23.6807547145596), id:0},{coin:new Coin(-24.921450642761087,-18.790469255696,12.598715548243229), id:1},{coin:new Coin(-27.462924457464283,-2.307453076982202,27.675888071372412), id:2},{coin:new Coin(-23.805440095101684,-0.1719164638306439,14.159121596734865), id:3},{coin:new Coin(-20.56923064468872,6.566093724474566,3.2759960140734043), id:4},{coin:new Coin(-25.840046212444445,3.0154379627539645,-12.129077180554676), id:5},{coin:new Coin(-0.12415848898914678,-17.24941169186156,-24.089012115869895), id:6},{coin:new Coin(20.648080318582544,-17.306545828389865,-14.154882378054586), id:7},{coin:new Coin(-10.369619229139987,22.97033964184665,7.926012599432754), id:8},{coin:new Coin(-17.40703956405811,18.42114835252625,9.379360551126528), id:9},{coin:new Coin(-16.003631234123016,18.504382214049656,-9.02703983024753), id:10},{coin:new Coin(5.466352142045469,12.823046543316853,-5.71501482514302), id:11},{coin:new Coin(5.577967875069705,3.1178514503821235,-1.6601071460354084), id:12},{coin:new Coin(22.806035443552588,-3.0971670654445695,18.953290393314937), id:13},{coin:new Coin(-6.700701005799521,-1.2267676080840322,28.07123771418613), id:14},{coin:new Coin(4.055603794907487,3.025509693082835,12.990565917776475), id:15},{coin:new Coin(2.4669988262462175,11.025589439642443,17.30534563503105), id:16},{coin:new Coin(12.51818382505787,-9.440727474351826,8.645243996001899), id:17},{coin:new Coin(21.091926256689682,-17.4804758756722,19.756887434097596), id:18},{coin:new Coin(-26.076074016668006,-18.87840571816059,32.002286013087854), id:19},{coin:new Coin(1.8429647422443338,-2.455198049692979,-10.80308353746292), id:20},{coin:new Coin(-6.21747892581496,-0.5257501180103216,-16.89711795671381), id:21},{coin:new Coin(-24.44604455849146,-17.33125811800214,-21.788293355322484), id:22},{coin:new Coin(-21.49095086819052,3.7275512296245252,-8.44226482363607), id:23}];};L3D.createPeachCoins = function() { return [{coin:new Coin(-5.235079904099125,0.07417208986595411,-8.599114448384936), id:0},{coin:new Coin(-5.413573667252937,0.19509035740202668,-1.1941904950328774), id:1},{coin:new Coin(1.6988486739201933,0.4340094146515885,-8.231743908517105), id:2},{coin:new Coin(4.059418339215546,-0.39753959647229464,-3.743007737798272), id:3},{coin:new Coin(5.359520735057971,-1.0460829831125231,-5.929936710590241), id:4},{coin:new Coin(5.176978197016111,0.13802808132114674,-11.171963735389133), id:5},{coin:new Coin(3.4171209844522807,-0.3115318913043405,-7.849159339922742), id:6},{coin:new Coin(6.41062656545732,-0.03964424070287551,-6.445933178302108), id:7},{coin:new Coin(-0.02228694178575394,-0.15414844320311738,-1.4228652604536483), id:8},{coin:new Coin(8.757734361004703,-0.29458111538940124,-3.3125913130702878), id:9},{coin:new Coin(8.302585268565899,0.5007248161435802,-9.477574353301717), id:10},{coin:new Coin(1.0403238273317053,0.5157597438067554,-5.758876821657185), id:11},{coin:new Coin(-3.911676426275694,0.6629865621989456,-11.94799528543801), id:12},{coin:new Coin(0.4006795688979661,2.73126733573882,-8.621849519941263), id:13},{coin:new Coin(-1.1567000602429496,0.1828061701367549,-2.667327870723106), id:14},{coin:new Coin(2.3493996403524253,2.933219948717814,-9.746003678221635), id:15}];};L3D.createWhompCoins = function() { return [{coin:new Coin(-2.4157344935197114,1.017684060480547,-10.032591045262926), id:0},{coin:new Coin(-7.341855309456012,1.1322896589120628,-9.769992599277385), id:1},{coin:new Coin(-7.374331362558681,1.071547044674478,-0.9477389539605262), id:2},{coin:new Coin(-5.531214982794241,2.702752805023566,1.0736370269223623), id:3},{coin:new Coin(-5.925659207559994,2.6735848591423297,6.201237637253563), id:4},{coin:new Coin(-1.478378056568923,8.03301224261664,7.95776331451268), id:5},{coin:new Coin(-3.686901895813493,9.163140436197086,0.6166726517030389), id:6},{coin:new Coin(6.339153235208609,2.6318224943463466,-6.90745566001803), id:7},{coin:new Coin(-4.840844060245297,2.643852426502599,-6.93916012316247), id:8},{coin:new Coin(-1.2058237342540437,5.90897251643025,-4.322584118335105), id:9},{coin:new Coin(8.382969423873579,5.877715896795154,0.8559640468694069), id:10},{coin:new Coin(3.46998114130984,11.923929408851594,0.6137825641039436), id:11},{coin:new Coin(3.4371863972100134,8.112582596318575,-1.0093070710469552), id:12},{coin:new Coin(5.894548538781485,5.8943079704392645,4.81148179622459), id:13},{coin:new Coin(9.330045462937534,1.2651897609824323,3.0471521646724025), id:14},{coin:new Coin(5.354169622560676,5.932807029059612,-1.2963396047827296), id:15},{coin:new Coin(3.267000322138261,8.101398508812348,4.364560415205406), id:16},{coin:new Coin(-3.6671752808717626,2.6944515363902846,8.992233386085244), id:17},{coin:new Coin(1.3251238380535852,5.915046469714194,4.084935001469486), id:18},{coin:new Coin(-3.1695195141885413,5.3435578992270685,2.4975385711013085), id:19},{coin:new Coin(-5.39267342545507,2.7397917960977662,4.542043994699594), id:20},{coin:new Coin(-6.439756017669449,0.9834415739967381,2.1812912475789505), id:21},{coin:new Coin(1.3054180709194472,5.827111832823774,-3.0174796591889828), id:22},{coin:new Coin(-2.9068088519798336,2.4384097235035496,-5.419457981107549), id:23}];}; diff --git a/js/l3d/src/scenes/initScene.js b/js/l3d/src/scenes/initScene.js index 68e1093..6c54079 100644 --- a/js/l3d/src/scenes/initScene.js +++ b/js/l3d/src/scenes/initScene.js @@ -1,3 +1,23 @@ +// http://stackoverflow.com/questions/2450954/how-to-randomize-shuffle-a-javascript-array#answer-2450976 +L3D.shuffle = function(array) { + var currentIndex = array.length, temporaryValue, randomIndex ; + + // While there remain elements to shuffle... + while (0 !== currentIndex) { + + // Pick a remaining element... + randomIndex = Math.floor(Math.random() * currentIndex); + currentIndex -= 1; + + // And swap it with the current element. + temporaryValue = array[currentIndex]; + array[currentIndex] = array[randomIndex]; + array[randomIndex] = temporaryValue; + } + + return array; +}; + L3D.LogFunction = function(a,b) { var val = 100*a/b; $('.progress-bar').css('width', val+'%').attr('aria-valuenow', val); @@ -195,19 +215,42 @@ L3D.resetBobombElements = function() { }; }; -L3D.createBobombCoins = function() { +L3D.generateCoins = function(totalCoins, coin_ids) { + + if (coin_ids === undefined) + L3D.shuffle(totalCoins); + else { + + for (var i = 0; i < coin_ids.length; i++) { + + for (var j = 0; j < totalCoins.length; j++) { + + if (coin_ids[i] === totalCoins[j].id) { + + // Swap i and j + var tmp = totalCoins[i]; + totalCoins[i] = totalCoins[j]; + totalCoins[j] = tmp; + + } + + } + } + } + + var indices = []; var coins = []; - coins.push( - new Coin(-1.6204001515660262,12.245208850063094,-24.871861611322934), - new Coin(23.509767766131876,13.6929075780209,-6.1716274892265615), - new Coin(34.797219873325524,13.088500612704706,-2.1784858128827413), - new Coin(-23.255456493345882,15.763954882327724,-11.08029248078497), - new Coin(-7.238094745133173,12.95460420281499,-3.1009487490121885), - new Coin(-17.10578612221326,24.17871082944758,-11.574224169812915), - new Coin(-12.418656949661646,17.09780294217035,32.472022253887665), - new Coin(7.132802719121488,8.802400710545713,22.258165594421055) - ); + for (var i = 0; i < 8; i++) { + coins.push(totalCoins[i].coin); + totalCoins[i].coin.id = totalCoins[i].id; + indices.push(totalCoins[i].id); + } + + console.log(coin_ids, indices) + + if (coin_ids === undefined) + L3D.DB.Private.sendData('/posts/coin-id', {indices : indices}); return coins; }; @@ -277,7 +320,7 @@ L3D.createBobombRecommendations = function(width, height) { }; -L3D.initBobomb = function(camera, scene, coins, clickable) { +L3D.initBobomb = function(camera, scene, coins, clickable, coin_ids) { L3D.addLight(scene); var collidableObjects = []; @@ -293,7 +336,7 @@ L3D.initBobomb = function(camera, scene, coins, clickable) { scene.add(camera); Coin.init(); - var tmp = L3D.createBobombCoins(); + var tmp = L3D.generateCoins(L3D.createBobombCoins(), coin_ids); for (var i in tmp) { coins.push(tmp[i]); @@ -431,19 +474,6 @@ L3D.createWhompRecommendations = function(width, height) { return recos; }; -L3D.createWhompCoins = function() { - return [ - new Coin(-5.529176900669821,2.886514571524507,4.127968972716147), - new Coin(-3.336263561768484,9.341710952326468,1.0230063543998414), - new Coin(1.985057515492925,12.151756532082196,1.3355674703297925), - new Coin(8.100383890535953,4.6489182333624335,1.9132972963126775), - new Coin(0.6049016864458896,6.2498603432959584,3.6272087520336264), - new Coin(-1.4497656612870164,6.263594147452652,-4.0488101538390694), - new Coin(6.753883218882444,2.019245026490682,-7.001046531863012), - new Coin(3.4354286209455246,3.487313067990168,-4.091947594995703) - ]; -}; - L3D.resetWhompElements = function() { return { position : new THREE.Vector3(-6.725817925071645,1.4993570618328055,-10.356480813212423), @@ -451,7 +481,7 @@ L3D.resetWhompElements = function() { }; }; -L3D.initWhomp = function(recommendation, scene, coins, clickable) { +L3D.initWhomp = function(recommendation, scene, coins, clickable, coin_ids) { L3D.addLight(scene); var collidableObjects = []; @@ -467,7 +497,7 @@ L3D.initWhomp = function(recommendation, scene, coins, clickable) { scene.add(recommendation); Coin.init(0.002); - var tmp = L3D.createWhompCoins(); + var tmp = L3D.generateCoins(L3D.createWhompCoins(), coin_ids); for (var i in tmp) { coins.push(tmp[i]); @@ -517,19 +547,6 @@ L3D.initMountainScene = function(scene, collidableObjects, recommendation, click collidableObjects.push(loader.obj); }; -L3D.createMountainCoins = function() { - return [ - new Coin(-18.766484229298513,-6.174512332611151,16.379061147364553), - new Coin(-22.48878786991581,-17.698282433679474,1.6030258853572397), - new Coin(-8.604868977581164,-17.3348862459467,-11.923191659094416), - new Coin(24.81563047462934,-12.174170400556296,5.612049952487652), - new Coin(-6.4854226987006305,0.34787283214634307,-17.2093293607182), - new Coin(-14.50190371481413,20.88721463986533,7.923724946536855), - new Coin(-13.980787439949077,-0.10719616576499978,22.24889144136683), - new Coin(4.491305202472262,3.6813420775366277,10.03229664467681) - ]; -}; - L3D.createMountainRecommendations = function(width, height) { var recos = []; @@ -605,7 +622,7 @@ L3D.resetMountainElements = function() { }; }; -L3D.initMountain = function(recommendation, scene, coins, clickable) { +L3D.initMountain = function(recommendation, scene, coins, clickable, coin_ids) { L3D.addLight(scene); var collidableObjects = []; @@ -621,7 +638,7 @@ L3D.initMountain = function(recommendation, scene, coins, clickable) { scene.add(recommendation); Coin.init(); - var tmp = L3D.createMountainCoins(); + var tmp = L3D.generateCoins(L3D.createMountainCoins(), coin_ids); for (var i in tmp) { coins.push(tmp[i]); diff --git a/sql/backup.pgsql b/sql/backup.pgsql index 7349b2f..d309cb7 100644 --- a/sql/backup.pgsql +++ b/sql/backup.pgsql @@ -11,6 +11,7 @@ DROP TABLE IF EXISTS Experiment CASCADE; DROP TABLE IF EXISTS FpsCounter CASCADE; DROP TABLE IF EXISTS PointerLocked CASCADE; DROP TABLE IF EXISTS SwitchedLockOption CASCADE; +DROP TABLE IF EXISTS Coin CASCADE; DROP TYPE IF EXISTS VECTOR3 CASCADE; DROP TYPE IF EXISTS CAMERA CASCADE; @@ -33,89 +34,94 @@ CREATE TYPE CAMERA AS( ); -- Base tables -CREATE TABLE users( +CREATE TABLE Users( id SERIAL PRIMARY KEY, name CHAR(50) ); -CREATE TABLE scene( +CREATE TABLE Scene( id SERIAL PRIMARY KEY, name CHAR(50) ); -CREATE TABLE experiment( +CREATE TABLE Experiment( id SERIAL PRIMARY KEY, - user_id SERIAL REFERENCES users (id), - scene_id SERIAL REFERENCES scene (id) + user_id SERIAL REFERENCES Users (id), + scene_id SERIAL REFERENCES Scene (id) +); + +CREATE TABLE Coin( + exp_id SERIAL REFERENCES Experiment (id), + coin_id INTEGER ); -- Init scene table -INSERT INTO scene(name) VALUES ('peachcastle'); -INSERT INTO scene(name) VALUES ('bobomb'); -INSERT INTO scene(name) VALUES ('coolcoolmountain'); -INSERT INTO scene(name) VALUES ('whomp'); +INSERT INTO Scene(name) VALUES ('peachcastle'); +INSERT INTO Scene(name) VALUES ('bobomb'); +INSERT INTO Scene(name) VALUES ('coolcoolmountain'); +INSERT INTO Scene(name) VALUES ('whomp'); -- Events -CREATE TABLE arrowclicked( +CREATE TABLE ArrowClicked( id SERIAL PRIMARY KEY, - exp_id SERIAL REFERENCES experiment (id), + exp_id SERIAL REFERENCES Experiment (id), time TIMESTAMP DEFAULT NOW(), arrow_id INTEGER ); -CREATE TABLE coinclicked( +CREATE TABLE CoinClicked( id SERIAL PRIMARY KEY, - exp_id SERIAL REFERENCES experiment (id), + exp_id SERIAL REFERENCES Experiment (id), time TIMESTAMP DEFAULT NOW(), coin_id INTEGER ); -CREATE TABLE keyboardevent( +CREATE TABLE KeyboardEvent( id SERIAL PRIMARY KEY, - exp_id SERIAL REFERENCES experiment (id), + exp_id SERIAL REFERENCES Experiment (id), time TIMESTAMP DEFAULT NOW(), camera CAMERA ); -CREATE TABLE resetclicked( +CREATE TABLE ResetClicked( id SERIAL PRIMARY KEY, - exp_id SERIAL REFERENCES experiment (id), + exp_id SERIAL REFERENCES Experiment (id), time TIMESTAMP DEFAULT NOW() ); -CREATE TABLE previousnextclicked( +CREATE TABLE PreviousNextClicked( id SERIAL PRIMARY KEY, - exp_id SERIAL REFERENCES experiment (id), + exp_id SERIAL REFERENCES Experiment (id), previousnext PREVIOUSNEXT NOT NULL, time TIMESTAMP DEFAULT NOW(), camera CAMERA ); -CREATE TABLE hovered( +CREATE TABLE Hovered( id SERIAL PRIMARY KEY, - exp_id SERIAL REFERENCES experiment (id), + exp_id SERIAL REFERENCES Experiment (id), start BOOLEAN NOT NULL, time TIMESTAMP DEFAULT NOW(), arrow_id INTEGER ); -CREATE TABLE fpscounter( +CREATE TABLE FpsCounter( id SERIAL PRIMARY KEY, - exp_id SERIAL REFERENCES experiment (id), + exp_id SERIAL REFERENCES Experiment (id), time TIMESTAMP DEFAULT NOW(), fps REAL ); -CREATE TABLE pointerlocked( +CREATE TABLE PointerLocked( id SERIAL PRIMARY KEY, - exp_id SERIAL REFERENCES experiment (id), + exp_id SERIAL REFERENCES Experiment (id), time TIMESTAMP DEFAULT NOW(), locked BOOLEAN ); -CREATE TABLE switchedlockoption( +CREATE TABLE SwitchedLockOption( id SERIAL PRIMARY KEY, - exp_id SERIAL REFERENCES experiment (id), + exp_id SERIAL REFERENCES Experiment (id), time TIMESTAMP DEFAULT NOW(), locked BOOLEAN );