Monster commit
- New analysis functions - Scene rotation and scale done server side - PGSQL files are now launchable - New sql queries - Removed dependancy from ip
This commit is contained in:
6
sql/backup.pgsql
Normal file → Executable file
6
sql/backup.pgsql
Normal file → Executable file
@@ -1,3 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
psql interface 3dinterface << E_O_SQL
|
||||
|
||||
-- Clear database from previous tables (just in case...)
|
||||
DROP TABLE IF EXISTS Users CASCADE;
|
||||
DROP TABLE IF EXISTS Arrowclicked CASCADE;
|
||||
@@ -154,3 +158,5 @@ CREATE TABLE SwitchedLockOption(
|
||||
time TIMESTAMP DEFAULT NOW(),
|
||||
locked BOOLEAN
|
||||
);
|
||||
|
||||
E_O_SQL
|
||||
|
||||
6
sql/check.pgsql
Normal file → Executable file
6
sql/check.pgsql
Normal file → Executable file
@@ -1,3 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
psql interface 3dinterface << E_O_SQL
|
||||
|
||||
-- Checks that each user has never twice either the same scene or the same recommendation style
|
||||
SELECT count(*) = 0
|
||||
FROM
|
||||
@@ -32,3 +36,5 @@ FROM (
|
||||
GROUP BY Experiment.coin_combination_id
|
||||
HAVING count(CoinCombination.id) != 1
|
||||
) AS T;
|
||||
|
||||
E_O_SQL
|
||||
|
||||
11
sql/scenes.pgsql
Executable file
11
sql/scenes.pgsql
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
psql interface 3dinterface << E_O_SQL
|
||||
|
||||
ALTER TABLE Scene ADD recommendation_number INTEGER;
|
||||
|
||||
UPDATE SCENE SET recommendation_number = 11 WHERE id = 2;
|
||||
UPDATE SCENE SET recommendation_number = 11 WHERE id = 3;
|
||||
UPDATE SCENE SET recommendation_number = 10 WHERE id = 4;
|
||||
|
||||
E_O_SQL
|
||||
33
sql/test.pgsql
Executable file
33
sql/test.pgsql
Executable file
@@ -0,0 +1,33 @@
|
||||
#! /bin/sh
|
||||
|
||||
psql interface 3dinterface << E_O_SQL
|
||||
|
||||
SELECT * FROM (
|
||||
SELECT Users.id AS user_id,
|
||||
Experiment.id AS exp_id,
|
||||
Scene.name AS scene_name,
|
||||
Scene.recommendation_number AS reco_total,
|
||||
count(DISTINCT ArrowClicked.arrow_id) AS reco_clicked,
|
||||
-- Scene.recommendation_number - 2 <= count(DISTINCT ArrowClicked.arrow_id) AS reco_clicker
|
||||
100 * count(DISTINCT ArrowClicked.arrow_id) / Scene.recommendation_number AS reco_percent
|
||||
|
||||
FROM Users, Experiment, CoinCombination, ArrowClicked, Scene
|
||||
-- JOIN conditions
|
||||
WHERE Experiment.user_id = Users.id AND
|
||||
CoinCombination.id = Experiment.coin_combination_id AND
|
||||
ArrowClicked.exp_id = Experiment.id AND
|
||||
Scene.id = CoinCombination.scene_id AND
|
||||
|
||||
-- other conditions
|
||||
Experiment.finished AND
|
||||
CoinCombination.scene_id != 1 AND
|
||||
Users.valid
|
||||
|
||||
GROUP BY Users.id, Experiment.id, Scene.name, Scene.recommendation_number
|
||||
) T
|
||||
WHERE reco_percent > 75
|
||||
ORDER BY reco_percent
|
||||
|
||||
;
|
||||
|
||||
E_O_SQL
|
||||
Reference in New Issue
Block a user