INSERT INTO `ima_game` (`Game_ID`, `Name`, `Resource_URL`, `Executable`, `Description`,`Version`,  `Display_Order`, `Active`, `Last_Edit`) VALUES
(56, 'The great obstacle course', '/images/games/gamefullbody1.png', 'GameJumpingJacks', 'Users are asked to move their arms and legs to avoid obstacles and get all light blue coins.',1,10, 1, CURRENT_TIMESTAMP),
(57, 'Jumping jack', '/images/games/gamefullbody2.png', 'GameJumpingJacks2', 'Users are asked move their arms and legs accordingly to the direction of the arrows inside the coins.',1,10, 1, CURRENT_TIMESTAMP),
(58, 'Run, run... RUUUN!', '/images/games/gamehighknees.png', 'GameHighKnees', 'Users are asked to run in place lifting their knees the higher they can.',1,10, 1, CURRENT_TIMESTAMP);

INSERT INTO `ima_game_device` (`Game_ID`, `Device_ID`, `Active`, `Last_Edit`) VALUES
(56, 1, 1, CURRENT_TIMESTAMP),
(56, 6, 1, CURRENT_TIMESTAMP),
(57, 1, 1, CURRENT_TIMESTAMP),
(57, 6, 1, CURRENT_TIMESTAMP),
(58, 1, 1, CURRENT_TIMESTAMP),
(58, 6, 1, CURRENT_TIMESTAMP);


INSERT INTO `ima_game_dependency` (`Game_ID`, `Resource_ID`, `Order`, `Active`, `Last_Edit`) VALUES
(56, 1, 1, 1, CURRENT_TIMESTAMP),
(56, 2, 2, 1, CURRENT_TIMESTAMP),
(56, 3, 3, 1, CURRENT_TIMESTAMP),
(56, 11, 4, 1, CURRENT_TIMESTAMP),
(56, 10, 4, 1, CURRENT_TIMESTAMP),

(57, 1, 1, 1, CURRENT_TIMESTAMP),
(57, 2, 2, 1, CURRENT_TIMESTAMP),
(57, 3, 3, 1, CURRENT_TIMESTAMP),
(57, 11, 4, 1, CURRENT_TIMESTAMP),
(57, 10, 4, 1, CURRENT_TIMESTAMP),

(58, 1, 1, 1, CURRENT_TIMESTAMP),
(58, 2, 2, 1, CURRENT_TIMESTAMP),
(58, 3, 3, 1, CURRENT_TIMESTAMP),
(58, 11, 4, 1, CURRENT_TIMESTAMP),
(58, 10, 4, 1, CURRENT_TIMESTAMP);

INSERT INTO `ima_game_parameter_association` (`Game_ID`, `Parameter_ID`, `Optional_Parameter`, `Active`, `Last_Edit`) VALUES
(56, 1, 0, 1,CURRENT_TIMESTAMP),
(56, 104, 0, 1,CURRENT_TIMESTAMP),
(56, 105, 0, 1,CURRENT_TIMESTAMP),
(56, 141, 0, 1,CURRENT_TIMESTAMP),
(56, 142, 0, 1,CURRENT_TIMESTAMP),
(56, 143, 0, 1,CURRENT_TIMESTAMP),
(56, 144, 0, 1,CURRENT_TIMESTAMP),

(57, 1, 0, 1,CURRENT_TIMESTAMP),
(57, 145, 0, 1,CURRENT_TIMESTAMP),
(57, 146, 0, 1,CURRENT_TIMESTAMP),

(58, 1, 0, 1,CURRENT_TIMESTAMP),
(58, 145, 0, 1,CURRENT_TIMESTAMP),
(42, 147, 0, 1,CURRENT_TIMESTAMP),

(5, 89, 0, 1, CURRENT_TIMESTAMP),
(5, 90, 0, 1, CURRENT_TIMESTAMP),

(56, 154, 0, 1, CURRENT_TIMESTAMP),
(57, 154, 0, 1, CURRENT_TIMESTAMP),
(58, 154, 0, 1, CURRENT_TIMESTAMP),

(42, 154, 0, 1, CURRENT_TIMESTAMP);

DELETE FROM `ima_game_parameter_association` WHERE Game_ID=5 and Parameter_ID in (12,85);

INSERT INTO `ima_game_parameter` (`Parameter_ID`, `Device_ID`, `Name`, `Label`, `Description`, `Default`, `Order`, `Levelable`, `Active`) VALUES
(141, NULL, 'distractors', 'percentage proportion of distractors', 'Defines the percentage of distractors there should be in proportion to the total number of objects.', 0, 0, 1, 1),
(142, NULL, 'laterals', 'percentage proportion of feet elements', 'Defines the percentage of feet elements.', 0, 0, 1, 1),
(143, NULL, 'doubles', 'percentage proportion of double elements', 'Defines the percentage of double elements, i.e. elements that shall be taken with two limbs contemporary.', 0, 0, 1, 1),
(144, NULL, 'rhythm', 'rhythm of the game', 'Defines the rhythm of the game, if random the elements are inserted randomly.', 0, 0, 1, 1),
(145, NULL, 'speed', 'Speed', 'Defines the target speed of the movement to perform.', 0, 0, 1, 1),
(146, NULL, 'rhythm', 'rhythm of the game', 'Defines in which order the limb of the patient shall move to play the game.', 0, 0, 1, 1),
(147, NULL, 'middlestep', 'enable central position', 'Enables the obstacles that need to be passed through while keeping an intermediate position between sitted and standing.', 0, 0, 1, 1),
(154, NULL, 'adaptive', 'HR adaptive', 'Make the game speed adaptive to the HR.', 0, 0, 0, 1);


INSERT INTO `ima_game_parameter_value` (`Parameter_ID`, `Value`, `Label`, `Description`, `Active`, `Last_Edit`, `Default`, `Order`) VALUES
(141, 'none','none',NULL, 1, CURRENT_TIMESTAMP, 0, 0),
(141, 'few','few',NULL, 1, CURRENT_TIMESTAMP, 1, 1),
(141, 'some','some',NULL, 1, CURRENT_TIMESTAMP, 0, 2),
(141, 'many','many',NULL, 1, CURRENT_TIMESTAMP, 0, 3),
(141, 'all','all',NULL, 1, CURRENT_TIMESTAMP, 0, 4),

(142, 'none', 'none', NULL, 1, CURRENT_TIMESTAMP, 0, 1),
(142, 'few', 'few', NULL, 1, CURRENT_TIMESTAMP, 0, 2),
(142, 'some', 'some', NULL, 1, CURRENT_TIMESTAMP, 1, 3),
(142, 'many', 'many', NULL, 1, CURRENT_TIMESTAMP, 0, 4),
(142, 'all', 'all', NULL, 0, CURRENT_TIMESTAMP, 0, 5),

(143, 'none', 'none', NULL, 1, CURRENT_TIMESTAMP, 0, 1),
(143, 'few', 'few', NULL, 1, CURRENT_TIMESTAMP, 0, 2),
(143, 'some', 'some', NULL, 1, CURRENT_TIMESTAMP, 1, 3),
(143, 'many', 'many', NULL, 1, CURRENT_TIMESTAMP, 0, 4),
(143, 'all', 'all', NULL, 0, CURRENT_TIMESTAMP, 0, 5),

(144, 'random', 'random', NULL, 1, CURRENT_TIMESTAMP, 0, 1),
(144, 'summer', 'summer', NULL, 1, CURRENT_TIMESTAMP, 1, 2),

(145, 'very-slow', 'very slow', NULL, 1, CURRENT_TIMESTAMP, 0, 1),
(145, 'slow', 'slow', NULL, 1, CURRENT_TIMESTAMP, 0, 2),
(145, 'normal', 'normal', NULL, 1, CURRENT_TIMESTAMP, 1, 3),
(145, 'fast', 'fast', NULL, 1, CURRENT_TIMESTAMP, 0, 4),
(145, 'very-fast', 'very fast', NULL, 1, CURRENT_TIMESTAMP, 0, 5),

(146, 'all', 'all', NULL, 1, CURRENT_TIMESTAMP, 1, 1),
(146, 'clockwise', 'clockwise', NULL, 1, CURRENT_TIMESTAMP, 0, 2),
(146, 'counterclockwise', 'counterclockwise', NULL, 1, CURRENT_TIMESTAMP, 0, 3),
(146, 'side', 'side', NULL, 1, CURRENT_TIMESTAMP, 0, 4),
(147, 'no', 'no', NULL, 1, CURRENT_TIMESTAMP, 1, 1),
(147, 'yes', 'yes', NULL, 1, CURRENT_TIMESTAMP, 0, 2),
(154, 'none', 'none', NULL, 1, CURRENT_TIMESTAMP, 1, 1),
(154, '0', 'no warmup', NULL, 1, CURRENT_TIMESTAMP, 0, 2),
(154, '5', '5s warmup', NULL, 1, CURRENT_TIMESTAMP, 0, 3),
(154, '10', '10s warmup', NULL, 1, CURRENT_TIMESTAMP, 0, 4),
(154, '20', '20s warmup', NULL, 1, CURRENT_TIMESTAMP, 0, 5),
(154, '30', '30s warmup', NULL, 1, CURRENT_TIMESTAMP, 0, 6);



INSERT INTO `cb_leaderboard` (`Id`, `Title`, `Description`, `UniqueRecords`, `ValueType`, `OrderType`, `AllowAnonymous`) VALUES
(54, 'The great obstacle course', 'Leaderboard for The great obstacle course', 0, 0, 0, 0),
(55, 'Jumping Jack', 'Leaderboard for Jumping Jack', 0, 0, 0, 0),
(56, 'Run, puppet, RUN!', 'Leaderboard for Run, puppet, RUN!', 0, 0, 0, 0);

INSERT INTO `ima_game_output`(`Id`,`Game_ID`, `Name`, `Parameter`,`Description`) VALUES 
(194, 56,'Score','{final-score}','The score of the play.'),
(195, 56,'Correct','{correct}/({input-parameters.duration}/{60})','Total coins taken by minute.'),
(196, 56,'Wrong','{wrong}/({input-parameters.duration}/{60})','Total obstacles collided by minute.'),
(197, 56,'Accuracy','({correct}/({missed-correct}+{correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})','Accuracy of the play.'),
(198, 57,'Score','{final-score}','The score of the play.'),
(199, 57,'Correct','{correct}/({input-parameters.duration}/{60})','Coins taken.'),
(200, 58,'Score','{final-score}','The score of the play.'),
(201, 58,'Correct','{correct}/({input-parameters.duration}/{60})','Coins taken by minute.'),
(202, 58,'Wrong','{hit}/({input-parameters.duration}/{60})','Hit time by minute.');


INSERT INTO `ima_chart_game_template` (`Chart_Template_ID`, `Game_ID`) VALUES
(  3,56),
(  4,56),
(  7,56),
( 44,56),
(269,56),
(270,56),
(275,56),
(311,56),

(324,56),
(335,56),
(336,56),
(337,56),
(338,56),
(339,56),
(340,56),
(341,56),
(342,56),

(  3,57),
(  4,57),
(  7,57),
( 44,57),
(269,57),
(270,57),
(275,57),
(343,57),
(344,57),
(345,57),

(  3,58),
(  4,58),
(  7,58),
( 44,58),
(269,58),
(270,58),
(275,58),
(343,58),
(346,58),
(347,58),

(348,5),
(349,5),
(350,5),
(351,5),
(352,5),
(353,5),

(402,56),
(403,56),
(404,56),

(402,57),
(403,57),
(404,57),
(402,58),
(403,58),
(404,58),
(403,42),
(402,3 ),
(402,4 ),
(402,5 ),
(402,7 ),
(402,8 ),
(402,10),
(402,14),
(402,15),
(402,16),
(402,17),
(402,18),
(402,19),
(402,20),
(402,22),
(402,23),
(402,24),
(402,25),
(402,26),
(402,28),
(402,30),
(402,31),
(402,32),
(402,36),
(402,37),
(402,39),
(402,40),
(402,41),
(402,42),
(402,43),
(402,52),
(402,53),
(402,54),

(404,3 ),
(404,4 ),
(404,5 ),
(404,7 ),
(404,8 ),
(404,10),
(404,14),
(404,15),
(404,16),
(404,17),
(404,18),
(404,19),
(404,20),
(404,22),
(404,23),
(404,24),
(404,25),
(404,26),
(404,28),
(404,30),
(404,31),
(404,32),
(404,36),
(404,37),
(404,39),
(404,40),
(404,41),
(404,42),
(404,43),
(404,52),
(404,53),
(404,54),

(405,3 ),
(405,4 ),
(405,5 ),
(405,7 ),
(405,8 ),
(405,10),
(405,14),
(405,15),
(405,16),
(405,17),
(405,18),
(405,19),
(405,20),
(405,22),
(405,23),
(405,24),
(405,25),
(405,26),
(405,28),
(405,30),
(405,31),
(405,32),
(405,36),
(405,37),
(405,39),
(405,40),
(405,41),
(405,42),
(405,43),
(405,52),
(405,53),
(405,54),
(405,56),
(405,57),
(405,58);



INSERT INTO `ima_chart_template` (`Chart_Template_ID`, `Type_ID`, `Name`, `Title`, `Resource_URL`, `Description`, `Session_Bound`, `Optional`, `Display_Order`, `Active`, `Last_Edit`) VALUES
(311, 5, 'wrong-obj', 'Obstacle', NULL, 'This chart shows how many obstacle were avoided by the player.', 1, 1, 0, 1, CURRENT_TIMESTAMP),
(324, 7, 'wrong-obj-global', 'Obstacle', NULL, 'This chart shows how many obstacle were avoided by the player.', 0, 1, 0, 1, CURRENT_TIMESTAMP);

INSERT INTO `ima_chart_template` (`Chart_Template_ID`, `Type_ID`, `Name`, `Title`, `Resource_URL`, `Description`, `Session_Bound`, `Optional`, `Display_Order`, `Active`, `Last_Edit`) VALUES
(335, 5, 'correct-obj', 'Correct objects', NULL, 'This chart shows correct objects taken by the player.', 1, 1, 0, 1, CURRENT_TIMESTAMP),
(336, 10, 'correct-obj-pos', 'Correct objects by position', NULL, 'This chart shows how many correct objects were taken by the player by position.', 1, 1, 0, 1, CURRENT_TIMESTAMP),
(337, 10, 'wrong-obj-pos', 'Obstacle by position', NULL, 'This chart shows how many obstacle were avoided by the player by obstacle position.', 1, 1, 0, 1, CURRENT_TIMESTAMP),
(338, 11, 'globalSkifallDifficulty', 'Configuration parameters changes', NULL, 'For each session, this chart shows  possible configuration parameters changes compared to previous session configuration.', 0, 1, 0, 1, CURRENT_TIMESTAMP),
(341, 7, 'correct-wrong', 'Objects over time', NULL, 'This chart shows how many correct objects were taken and missed and how many obstacles were taken and avoided every 5 seconds', 1, 0, 0, 1, CURRENT_TIMESTAMP),
(342, 7, 'correct-obj-global', 'Correct objects', NULL, 'This chart shows correct objects taken by the player.', 0, 1, 0, 1, CURRENT_TIMESTAMP),
(343, 4, 'correct', 'Coins', NULL, 'This chart shows how many coins were taken by the player.', 1, 1, 0, 1, CURRENT_TIMESTAMP),
(344, 7, 'correct-global', 'Coins', NULL, 'This chart shows how many coins were taken by the player.', 0, 1, 0, 1, CURRENT_TIMESTAMP),
(345, 7, 'correct-line', 'Coins over time', NULL, 'This chart shows how many coins were taken every 5 seconds', 1, 0, 0, 1, CURRENT_TIMESTAMP),
(346, 7, 'correct-hit-global', 'Coins and hit', NULL, 'This chart shows how many coins were taken by the player.', 0, 1, 0, 1, CURRENT_TIMESTAMP),
(347, 7, 'correct-hit-line', 'Coins and hit over time', NULL, 'This chart shows how many coins were taken every 5 seconds', 1, 0, 0, 1, CURRENT_TIMESTAMP),

(348, 5, 'correct-cans-two-hands', 'Placed objects', NULL, 'This chart shows how many correct and wrong objects were placed in % and in absolute value in brackets.', 1, 0, 0, 1, CURRENT_TIMESTAMP),
(349, 10, 'correctcans-two-hands-left', 'Left hand placed objects per quadrant', NULL, 'This chart shows how many correct and wrong objects were placed in absolute value in every quadrant', 1, 1, 0, 1, CURRENT_TIMESTAMP),
(350, 10, 'correctcans-two-hands-right', 'Right hand placed objects per quadrant', NULL, 'This chart shows how many correct and wrong objects were placed in absolute value in every quadrant', 1, 1, 0, 1, CURRENT_TIMESTAMP),
(351, 7, 'globalcorrect-cans-two-hands', 'Placed objects per hand', NULL, 'This chart shows how many correct and wrong objects were placed per session.', 0, 0, 0, 1, CURRENT_TIMESTAMP),
(352, 7, 'globalcorrectcans-two-hands', 'Correctly placed objects per quadrant per hand', NULL, 'This chart shows how many correct objects were placed per quadrant per session.', 0, 1, 0, 1,CURRENT_TIMESTAMP),
(353, 7, 'globalwrongcans-two-hands', 'Wrongly placed objects per quadrant per hand', NULL, 'This chart shows how many wrong objects were placed per quadrant per session.', 0, 1, 0, 1, CURRENT_TIMESTAMP),

(402, 2, 'hrtracking', 'HR', NULL, 'This chart shows the HR every 5 seconds.', 1, 1, 0, 1, CURRENT_TIMESTAMP),
(403, 2, 'adaptivehr', 'HR adaptive', NULL, 'This chart shows the changes in adaptive speed of the games every 5 seconds.', 1, 1, 0, 1, CURRENT_TIMESTAMP),
(404, 6, 'hravg', 'Average HR', NULL, 'This chart shows the avg HR among the minimum and maximum HR ', 1, 1, 0, 1, CURRENT_TIMESTAMP),
(405, 2, 'hravg-global', 'Average HR', NULL, 'This chart shows the avg HR among the minimum and maximum HR per session.', 0, 1, 0, 1, CURRENT_TIMESTAMP);



INSERT INTO `ima_chart_template` (`Chart_Template_ID`, `Type_ID`, `Name`, `Title`, `Resource_URL`, `Description`, `Session_Bound`, `User_Bound`, `Optional`, `Display_Order`, `Active`, `Last_Edit`) VALUES
(339, 1, 'accuracygamejj', 'Accuracy', NULL, '', 0, 0, 1, 0, 1, CURRENT_TIMESTAMP),
(340, 7, 'monthlyaccuracygamejj', 'Accuracy monthly', NULL, '', 0, 0, 1, 0, 1, CURRENT_TIMESTAMP);



INSERT INTO `ima_chart_template_data` (`Chart_Template_ID`, `Name`, `Source`, `Data_Order`, `Active`, `Last_Edit`) VALUES
(311, 'Avoided obstacle', '{avoided-wrong}', 1, 1, CURRENT_TIMESTAMP),
(311, 'Collided obstacle', '{wrong}', 2, 1, CURRENT_TIMESTAMP);

INSERT INTO `ima_chart_template_data` (`Chart_Template_ID`, `Name`, `Source`, `Data_Order`, `Active`, `Last_Edit`) VALUES
(335, 'Correct', '{correct}', 1, 1, CURRENT_TIMESTAMP),
(335, 'Missed', '{missed-correct}', 2, 1, CURRENT_TIMESTAMP),

(336, 'Correct Left High', '{correct-left-top}', 1, 1, CURRENT_TIMESTAMP),
(336, '[diff]Correct Left High', '{missed-correct-left-top}', 2, 1, CURRENT_TIMESTAMP),
(336, 'Correct Left Middle', '{correct-left-middle}', 3, 1, CURRENT_TIMESTAMP),
(336, '[diff]Correct Left Middle', '{missed-correct-left-middle}', 4, 1, CURRENT_TIMESTAMP),
(336, 'Correct Left Low', '{correct-left-bottom}', 5, 1, CURRENT_TIMESTAMP),
(336, '[diff]Correct Left Low', '{missed-correct-left-bottom}', 6, 1, CURRENT_TIMESTAMP),
(336, 'Correct Left Foot Far', '{correct-feet-left-far}', 7, 1, CURRENT_TIMESTAMP),
(336, '[diff]Correct Left Foot Far', '{missed-correct-feet-left-far}', 8, 1, CURRENT_TIMESTAMP),
(336, 'Correct Left Foot Near', '{correct-feet-left-near}', 9, 1, CURRENT_TIMESTAMP),
(336, '[diff]Correct Left Foot Near', '{missed-correct-feet-left-near}', 10, 1, CURRENT_TIMESTAMP),
(336, 'Correct Right High', '{correct-right-top}', 11, 1, CURRENT_TIMESTAMP),
(336, '[diff]Correct Right High', '{missed-correct-right-top}', 12, 1, CURRENT_TIMESTAMP),
(336, 'Correct Right Middle', '{correct-right-middle}', 13, 1, CURRENT_TIMESTAMP),
(336, '[diff]Correct Right Middle', '{missed-correct-right-middle}', 14, 1, CURRENT_TIMESTAMP),
(336, 'Correct Right Low', '{correct-right-bottom}', 15, 1, CURRENT_TIMESTAMP),
(336, '[diff]Correct Right Low', '{missed-correct-right-bottom}', 16, 1, CURRENT_TIMESTAMP),
(336, 'Correct Right Foot Far', '{correct-feet-right-far}', 17, 1, CURRENT_TIMESTAMP),
(336, '[diff]Correct Right Foot Far', '{missed-correct-feet-right-far}', 18, 1, CURRENT_TIMESTAMP),
(336, 'Correct Right Foot Near', '{correct-feet-right-near}', 19, 1, CURRENT_TIMESTAMP),
(336, '[diff]Correct Right Foot Near', '{missed-correct-feet-right-near}', 20, 1, CURRENT_TIMESTAMP),

(337, 'Wrong Left High', '{wrong-left-top}', 1, 1, CURRENT_TIMESTAMP),
(337, '[diff]Wrong Left High', '{avoided-wrong-top}', 2, 1, CURRENT_TIMESTAMP),
(337, 'Wrong Left Middle', '{wrong-left-middle}', 3, 1, CURRENT_TIMESTAMP),
(337, '[diff]Wrong Left Middle', '{avoided-wrong-middle}+{avoided-wrong-middle-left}', 4, 1, CURRENT_TIMESTAMP),
(337, 'Wrong Left Low', '{wrong-left-bottom}', 5, 1, CURRENT_TIMESTAMP),
(337, '[diff]Wrong Left Low', '{avoided-wrong-low}', 6, 1, CURRENT_TIMESTAMP),
(337, 'Wrong Left Foot Far', '{wrong-feet-left-far}', 7, 1, CURRENT_TIMESTAMP),
(337, '[diff]Wrong Left Foot Far', '{avoided-wrong-feet-left-far}', 8, 1, CURRENT_TIMESTAMP),
(337, 'Wrong Left Foot Near', '{wrong-feet-left-near}', 9, 1, CURRENT_TIMESTAMP),
(337, '[diff]Wrong Left Foot Near', '{avoided-wrong-feet-near}', 10, 1, CURRENT_TIMESTAMP),
(337, 'Wrong Right High', '{wrong-right-top}', 11, 1, CURRENT_TIMESTAMP),
(337, '[diff]Wrong Right High', '{avoided-wrong-top}', 12, 1, CURRENT_TIMESTAMP),
(337, 'Wrong Right Middle', '{wrong-right-middle}', 13, 1, CURRENT_TIMESTAMP),
(337, '[diff]Wrong Right Middle', '{avoided-wrong-middle}+{avoided-wrong-middle-right}', 14, 1, CURRENT_TIMESTAMP),
(337, 'Wrong Right Low', '{wrong-right-bottom}', 15, 1, CURRENT_TIMESTAMP),
(337, '[diff]Wrong Right Low', '{avoided-wrong-low}', 16, 1, CURRENT_TIMESTAMP),
(337, 'Wrong Right Foot Far', '{wrong-feet-right-far}', 17, 1, CURRENT_TIMESTAMP),
(337, '[diff]Wrong Right Foot Far', '{avoided-wrong-feet-far}', 18, 1, CURRENT_TIMESTAMP),
(337, 'Wrong Right Foot Near', '{wrong-feet-right-near}', 19, 1, CURRENT_TIMESTAMP),
(337, '[diff]Wrong Right Foot Near', '{avoided-wrong-feet-near}', 20, 1, CURRENT_TIMESTAMP),


(338, 'Distractors', '{input-parameters.distractors}', 2, 1, CURRENT_TIMESTAMP),
(338, 'Feet', '{input-parameters.laterals}', 3, 1, CURRENT_TIMESTAMP),
(338, 'Duration', '{input-parameters.duration}', 1, 1, CURRENT_TIMESTAMP),
(338, 'Density', '{input-parameters.density}', 7, 1, CURRENT_TIMESTAMP),
(338, 'Speed', '{input-parameters.speed}', 5, 1, CURRENT_TIMESTAMP),
(338, 'Doubles', '{input-parameters.doubles}', 5, 1, CURRENT_TIMESTAMP),
(338, 'Rhythm', '{input-parameters.rhythm}', 5, 1, CURRENT_TIMESTAMP),
(338, 'x_axis', 'AUTO', 0, 1, CURRENT_TIMESTAMP),

(339, '80%-100%', '({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})>{0.8}+{OLD}', 1, 1, CURRENT_TIMESTAMP),
(339, '60%-80%', '(({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})<{0.8})*(({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})>{0.6})+{OLD}', 2, 1, CURRENT_TIMESTAMP),
(339, '40%-60%', '(({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})<{0.6})*(({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})>{0.4})+{OLD}', 3, 1, CURRENT_TIMESTAMP),
(339, '20%-40%', '(({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})<{0.4})*(({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})>{0.2})+{OLD}', 4, 1, CURRENT_TIMESTAMP),
(339, '0%-20%', '({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})<{0.2}', 5, 1, CURRENT_TIMESTAMP),

(340, '80%-100%', '({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})>{0.8}+{OLD}', 1, 1, CURRENT_TIMESTAMP),
(340, '60%-80%', '(({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})<{0.8})*(({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})>{0.6})+{OLD}', 2, 1, CURRENT_TIMESTAMP),
(340, '40%-60%', '(({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})<{0.6})*(({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})>{0.4})+{OLD}', 3, 1, CURRENT_TIMESTAMP),
(340, '20%-40%', '(({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})<{0.4})*(({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})>{0.2})+{OLD}', 4, 1, CURRENT_TIMESTAMP),
(340, '0%-20%', '({correct}/({correct}+{missed-correct})/{2})+({avoided-wrong}/({avoided-wrong}+{wrong})/{2})<{0.2}', 5, 1, CURRENT_TIMESTAMP),
(340, 'x_axis', 'MONTHLY', 0, 1, CURRENT_TIMESTAMP),

(341, 'Correct Missed', '{feedback-over-time.missed-correct}', 2, 1, CURRENT_TIMESTAMP),
(341, 'Correct Taken', '{feedback-over-time.correct}', 1, 1, CURRENT_TIMESTAMP),
(341, 'Wrong Avoided', '{feedback-over-time.avoided-wrong}', 4, 1, CURRENT_TIMESTAMP),
(341, 'Wrong Taken', '{feedback-over-time.wrong}', 3, 1, CURRENT_TIMESTAMP),

(342, 'Correct', '{correct}', 1, 1, CURRENT_TIMESTAMP),
(342, 'Missed', '{missed-correct}', 2, 1, CURRENT_TIMESTAMP),
(342, 'x_axis', 'AUTO', 0, 1, CURRENT_TIMESTAMP),

(343, 'Correct', '{correct}', 1, 1, CURRENT_TIMESTAMP),
(344, 'Correct', '{correct}', 1, 1, CURRENT_TIMESTAMP),
(344, 'x_axis', 'AUTO', 0, 1, CURRENT_TIMESTAMP),
(345, 'Correct', '{feedback-over-time.correct}', 1, 1, CURRENT_TIMESTAMP),
(346, 'Correct', '{correct}', 1, 1, CURRENT_TIMESTAMP),
(346, 'Hit', '{hit}', 1, 1, CURRENT_TIMESTAMP),
(346, 'x_axis', 'AUTO', 0, 1, CURRENT_TIMESTAMP),
(347, 'Correct', '{feedback-over-time.correct}', 1, 1, CURRENT_TIMESTAMP),
(347, 'Hit', '{feedback-over-time.hit}', 1, 1, CURRENT_TIMESTAMP),


(348, 'Correct left', '{correct-left}', 1, 1, CURRENT_TIMESTAMP),
(348, 'Wrong left', '{wrong-left}', 3, 1, CURRENT_TIMESTAMP),
(348, 'Correct right', '{correct-right}', 2, 1, CURRENT_TIMESTAMP),
(348, 'Wrong right', '{wrong-right}', 4, 1, CURRENT_TIMESTAMP),

(349, 'correct-left Bottom left', '{spatial-feedback.BottomLeft.correct-left}+{spatial-feedback.Bottom.correct-left}+{spatial-feedback.Left.correct-left}', 1, 1, CURRENT_TIMESTAMP),
(349, 'correct-left Bottom right', '{spatial-feedback.BottomRight.correct-left}+{spatial-feedback.Right.correct-left}', 2, 1, CURRENT_TIMESTAMP),
(349, 'correct-left Top Left', '{spatial-feedback.TopLeft.correct-left}+{spatial-feedback.Top.correct-left}', 3, 1, CURRENT_TIMESTAMP),
(349, 'correct-left Top Right', '{spatial-feedback.TopRight.correct-left}', 4, 1, CURRENT_TIMESTAMP),
(349, 'wrong-left Bottom left', '{spatial-feedback.BottomLeft.wrong-left}+{spatial-feedback.Left.wrong-left}+{spatial-feedback.Bottom.wrong-left}', 5, 1, CURRENT_TIMESTAMP),
(349, 'wrong-left Bottom right', '{spatial-feedback.BottomRight.wrong-left}+{spatial-feedback.Right.wrong-left}', 6, 1, CURRENT_TIMESTAMP),
(349, 'wrong-left Top left', '{spatial-feedback.TopLeft.wrong-left}+{spatial-feedback.Top.wrong-left}', 7, 1, CURRENT_TIMESTAMP),
(349, 'wrong-left Top right', '{spatial-feedback.TopRight.wrong-left}', 8, 1, CURRENT_TIMESTAMP),


(350, 'correct-right Bottom left', '{spatial-feedback.BottomLeft.correct-right}+{spatial-feedback.Bottom.correct-right}+{spatial-feedback.Left.correct-right}', 1, 1, CURRENT_TIMESTAMP),
(350, 'correct-right Bottom right', '{spatial-feedback.BottomRight.correct-right}+{spatial-feedback.Right.correct-right}', 2, 1, CURRENT_TIMESTAMP),
(350, 'correct-right Top Left', '{spatial-feedback.TopLeft.correct-right}+{spatial-feedback.Top.correct-right}', 3, 1, CURRENT_TIMESTAMP),
(350, 'correct-right Top Right', '{spatial-feedback.TopRight.correct-right}', 4, 1, CURRENT_TIMESTAMP),
(350, 'wrong-right Bottom left', '{spatial-feedback.BottomLeft.wrong-right}+{spatial-feedback.Left.wrong-right}+{spatial-feedback.Bottom.wrong-right}', 5, 1, CURRENT_TIMESTAMP),
(350, 'wrong-right Bottom right', '{spatial-feedback.BottomRight.wrong-right}+{spatial-feedback.Right.wrong-right}', 6, 1, CURRENT_TIMESTAMP),
(350, 'wrong-right Top left', '{spatial-feedback.TopLeft.wrong-right}+{spatial-feedback.Top.wrong-right}', 7, 1, CURRENT_TIMESTAMP),
(350, 'wrong-right Top right', '{spatial-feedback.TopRight.wrong-right}', 8, 1, CURRENT_TIMESTAMP),


(351, 'Correct left', '{correct-left}', 1, 1, CURRENT_TIMESTAMP),
(351, 'Correct right', '{correct-left}', 2, 1, CURRENT_TIMESTAMP),
(351, 'Wrong left', '{wrong-left}', 3, 1, CURRENT_TIMESTAMP),
(351, 'Wrong right', '{wrong-right}', 4, 1, CURRENT_TIMESTAMP),
(351, 'x_axis', 'AUTO', 0, 1, CURRENT_TIMESTAMP),

(352, 'Bottom left (left hand)', '{spatial-feedback.BottomLeft.correct-left}+{spatial-feedback.Bottom.correct-left}+{spatial-feedback.Left.correct-left}', 1, 1, CURRENT_TIMESTAMP),
(352, 'Bottom right (left hand)', '{spatial-feedback.BottomRight.correct-left}+{spatial-feedback.Right.correct-left}', 2, 1, CURRENT_TIMESTAMP),
(352, 'Top left (left hand)', '{spatial-feedback.TopLeft.correct-left}+{spatial-feedback.Top.correct-left}', 3, 1, CURRENT_TIMESTAMP),
(352, 'Top right (left hand)', '{spatial-feedback.TopRight.correct-left}', 4, 1, CURRENT_TIMESTAMP),

(352, 'Bottom left (right hand)', '{spatial-feedback.BottomLeft.correct-right}+{spatial-feedback.Bottom.correct-right}+{spatial-feedback.Left.correct-right}', 1, 1, CURRENT_TIMESTAMP),
(352, 'Bottom right (right hand)', '{spatial-feedback.BottomRight.correct-right}+{spatial-feedback.Right.correct-right}', 2, 1, CURRENT_TIMESTAMP),
(352, 'Top left (right hand)', '{spatial-feedback.TopLeft.correct-right}+{spatial-feedback.Top.correct-right}', 3, 1, CURRENT_TIMESTAMP),
(352, 'Top right (right hand)', '{spatial-feedback.TopRight.correct-right}', 4, 1, CURRENT_TIMESTAMP),

(352, 'x_axis', 'AUTO', 0, 1, CURRENT_TIMESTAMP),

(353, 'Bottom left (left hand)', '{spatial-feedback.BottomLeft.wrong-left}+{spatial-feedback.Bottom.wrong-left}+{spatial-feedback.Left.wrong-left}', 1, 1, CURRENT_TIMESTAMP),
(353, 'Bottom right (left hand)', '{spatial-feedback.BottomRight.wrong-left}+{spatial-feedback.Right.wrong-left}', 2, 1, CURRENT_TIMESTAMP),
(353, 'Top left (left hand)', '{spatial-feedback.TopLeft.wrong-left}+{spatial-feedback.Top.wrong-left}', 3, 1, CURRENT_TIMESTAMP),
(353, 'Top right (left hand)', '{spatial-feedback.TopRight.wrong-left}', 4, 1, CURRENT_TIMESTAMP),

(353, 'Bottom left (right hand)', '{spatial-feedback.BottomLeft.wrong-right}+{spatial-feedback.Bottom.wrong-right}+{spatial-feedback.Left.wrong-right}', 1, 1, CURRENT_TIMESTAMP),
(353, 'Bottom right (right hand)', '{spatial-feedback.BottomRight.wrong-right}+{spatial-feedback.Right.wrong-right}', 2, 1, CURRENT_TIMESTAMP),
(353, 'Top left (right hand)', '{spatial-feedback.TopLeft.wrong-right}+{spatial-feedback.Top.wrong-right}', 3, 1, CURRENT_TIMESTAMP),
(353, 'Top right (right hand)', '{spatial-feedback.TopRight.wrong-right}', 4, 1, CURRENT_TIMESTAMP),

(353, 'x_axis', 'AUTO', 0, 1, CURRENT_TIMESTAMP),

(402, 'HR', '{feedback-over-time.HR}', 1, 1, CURRENT_TIMESTAMP),
(403, 'Speed multiplier', '{feedback-over-time.adaptive}', 1, 1, CURRENT_TIMESTAMP),
(404, 'avg', '{HR.avg}', 1, 1, CURRENT_TIMESTAMP),
(404, 'max', '{HR.max}', 2, 1, CURRENT_TIMESTAMP),
(404, 'min', '{HR.min}', 0, 1, CURRENT_TIMESTAMP),
(405, 'avg', '{HR.avg}', 1, 1, CURRENT_TIMESTAMP),
(405, 'max', '{HR.max}', 1, 1, CURRENT_TIMESTAMP),
(405, 'min', '{HR.min}', 1, 1, CURRENT_TIMESTAMP);



INSERT INTO `ima_chart_template_option` (`Chart_Template_ID`, `Name`, `Value`, `Active`, `Last_Edit`) VALUES
(336, 'type', 'ten_diff', 1, CURRENT_TIMESTAMP),
(336, 'color-schema', 'positive_diff', 1, CURRENT_TIMESTAMP),

(337, 'type', 'ten_diff', 1, CURRENT_TIMESTAMP),
(337, 'color-schema', 'negative_diff', 1, CURRENT_TIMESTAMP),
(338, 'y-axis-label', 'variations', 1, CURRENT_TIMESTAMP),
(339, 'color-schema', 'stair', 1, CURRENT_TIMESTAMP),
(340, 'color-schema', 'stair', 1, CURRENT_TIMESTAMP),
(341, 'color-schema', 'diff', 1, CURRENT_TIMESTAMP),
(341, 'groupby', '2', 1, CURRENT_TIMESTAMP),
(341, 'time-interval', '5', 1, CURRENT_TIMESTAMP),
(342, 'color-schema', 'dual', 1, CURRENT_TIMESTAMP),
(343, 'color-schema', 'dual', 1, CURRENT_TIMESTAMP),
(344, 'color-schema', 'dual', 1, CURRENT_TIMESTAMP),
(345, 'color-schema', 'dual', 1, CURRENT_TIMESTAMP),
(345, 'time-interval', '5', 1, CURRENT_TIMESTAMP),
(346, 'color-schema', 'dual', 1, CURRENT_TIMESTAMP),
(346, 'groupby', '1', 1, CURRENT_TIMESTAMP),
(347, 'color-schema', 'dual', 1, CURRENT_TIMESTAMP),
(347, 'time-interval', '5', 1, CURRENT_TIMESTAMP),
(347, 'groupby', '1', 1, CURRENT_TIMESTAMP),
(348, 'check','{input-parameters.hand}={"both"}',1,CURRENT_TIMESTAMP),
(349, 'check','{input-parameters.hand}={"both"}',1,CURRENT_TIMESTAMP),
(349, 'color-schema', 'quadrants', 1, CURRENT_TIMESTAMP),
(349, 'type', 'double', 1, CURRENT_TIMESTAMP),
(350, 'check','{input-parameters.hand}={"both"}',1,CURRENT_TIMESTAMP),
(350, 'color-schema', 'quadrants', 1,CURRENT_TIMESTAMP),
(350, 'type', 'double',1,CURRENT_TIMESTAMP),

(351, 'check','{input-parameters.hand}={"both"}',1,CURRENT_TIMESTAMP),
(351, 'color-schema', 'dual',1,CURRENT_TIMESTAMP),

(352, 'check','{input-parameters.hand}={"both"}',1,CURRENT_TIMESTAMP),
(352, 'color-schema', 'positive',1,CURRENT_TIMESTAMP),

(353, 'check','{input-parameters.hand}={"both"}',1,CURRENT_TIMESTAMP),
(353, 'color-schema', 'negative',1,CURRENT_TIMESTAMP),

(402, 'time-interval', '5', 1, CURRENT_TIMESTAMP),
(403, 'time-interval', '5', 1, CURRENT_TIMESTAMP),
(402, 'device', '1,6', 1, CURRENT_TIMESTAMP),
(403, 'device', '1,6', 1, CURRENT_TIMESTAMP),
(403, 'check', '{input-parameters.adaptive}!{"none"}', 1, CURRENT_TIMESTAMP),
(404, 'device', '1,6', 1, CURRENT_TIMESTAMP),
(402, 'check', '{feedback-over-time.HR}+{SUM}>{0}', 1, CURRENT_TIMESTAMP),
(404, 'check', '{HR.avg}>{0}', 1, CURRENT_TIMESTAMP),
(405, 'device', '1,6', 1, CURRENT_TIMESTAMP),
(405, 'check', '{HR.avg}>{0}', 1, CURRENT_TIMESTAMP);

UPDATE `ima_chart_template_data` SET `Source`='{correct-top}+{correct-bottom}+{correct-middle}' WHERE Chart_Template_ID=249 and Name='Avoided';
UPDATE `ima_chart_template_data` SET `Source`='{wrong-top}+{wrong-bottom}+{wrong-middle}' WHERE Chart_Template_ID=249 and Name='Hit';

UPDATE `ima_chart_template_data` SET `Source`='{correct-top}+{correct-bottom}+{correct-middle}' WHERE Chart_Template_ID=260 and Name='Correct';
UPDATE `ima_chart_template_data` SET `Source`='{wrong-top}+{wrong-bottom}+{wrong-middle}' WHERE Chart_Template_ID=260 and Name='Wrong';

INSERT INTO `ima_chart_template_data` (`Chart_Template_ID`, `Name`, `Source`, `Data_Order`, `Active`, `Checksum`, `Last_Edit`) VALUES
(250, 'Middle', '{correct-middle}', 5, 1, NULL, '2020-09-24 12:57:07'),
(250, '[diff]Middle', '{wrong-middle}', 6, 1, NULL, '2020-09-24 12:57:07'),

(251, 'Correct middle', '{correct-middle}', 5, 1, NULL, '2020-09-24 12:57:07'),
(251, 'Wrong middle', '{wrong-middle}', 6, 1, NULL, '2020-09-24 12:57:07'),

(253, 'Middle', '{time-middle}', 3, 1, NULL, '2020-09-24 12:57:07'),

(254, 'Middle', '{feedback-over-time.time-middle}', 3, 1, NULL, '2020-09-24 12:57:07'),

(256, 'Middle', '{time-middle}', 3, 1, NULL, '2020-09-24 12:57:07'),

(258, 'correct middle', '{feedback-over-time.correct-middle}', 5, 1, NULL, '2020-09-24 12:57:07'),
(258, 'wrong middle', '{feedback-over-time.wrong-middle}', 6, 1, NULL, '2020-09-24 12:57:07');

UPDATE `ima_chart_template_data` SET `Source`='({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})<{0.2}+{OLD}' WHERE Chart_Template_ID=285 and Name='0%-20%';
UPDATE `ima_chart_template_data` SET `Source`='(({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})<{0.4})*(({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})>{0.2})+{OLD}' WHERE Chart_Template_ID=285 and Name='20%-40%';
UPDATE `ima_chart_template_data` SET `Source`='(({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})<{0.6})*(({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})>{0.4})+{OLD}' WHERE Chart_Template_ID=285 and Name='40%-60%';
UPDATE `ima_chart_template_data` SET `Source`='(({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})<{0.8})*(({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})>{0.6})+{OLD}' WHERE Chart_Template_ID=285 and Name='60%-80%';
UPDATE `ima_chart_template_data` SET `Source`='({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})>{0.8}+{OLD}' WHERE Chart_Template_ID=285 and Name='80%-100%';

UPDATE `ima_chart_template_data` SET `Source`='({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})<{0.2}+{OLD}' WHERE Chart_Template_ID=295 and Name='0%-20%';
UPDATE `ima_chart_template_data` SET `Source`='(({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})<{0.4})*(({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})>{0.2})+{OLD}' WHERE Chart_Template_ID=295 and Name='20%-40%';
UPDATE `ima_chart_template_data` SET `Source`='(({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})<{0.6})*(({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})>{0.4})+{OLD}' WHERE Chart_Template_ID=295 and Name='40%-60%';
UPDATE `ima_chart_template_data` SET `Source`='(({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})<{0.8})*(({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})>{0.6})+{OLD}' WHERE Chart_Template_ID=295 and Name='60%-80%';
UPDATE `ima_chart_template_data` SET `Source`='({correct-top}+{correct-bottom}+{correct-middle})/({correct-top}+{correct-middle}+{wrong-middle}+{wrong-top}+{correct-bottom}+{wrong-bottom})>{0.8}+{OLD}' WHERE Chart_Template_ID=295 and Name='80%-100%';

UPDATE `rehab_option` SET `Active`=1, `Value`='true' WHERE `Key`='show HR';
