 --
 DROP TABLE IF EXISTS `lc60_subtask_subtask_category`;
 
-CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `lc60_subtask_subtask_category` AS select `subtask`.`id` AS `subtask_id`,`subtask`.`task_id` AS `task_id`,`subtask`.`subtask_super_id` AS `subtask_super_id`,`subtask`.`subtask_name` AS `subtask_name`,`subtask`.`subtask_category_id` AS `subtask_category_id`,`subtask`.`subtask_base_value` AS `subtask_base_value`,`subtask`.`subtask_max_value` AS `subtask_max_value`,`subtask`.`subtask_starting_demand` AS `subtask_starting_demand`,`subtask`.`subtask_inflation_rate` AS `subtask_inflation_rate`,`subtask`.`subtask_demand_cutoff` AS `subtask_demand_cutoff`,`subtask`.`subtask_description` AS `subtask_description`,`subtask`.`subtask_url` AS `subtask_url`,`subtask`.`subtask_accumulative` AS `subtask_accumulative`,`subtask`.`subtask_task_period_demand` AS `subtask_task_period_demand`,`subtask`.`participant_id` AS `participant_id`,`subtask`.`subtask_dividend_rate` AS `subtask_dividend_rate`,`subtask`.`subtask_image` AS `subtask_image`,`subtask`.`subtask_symbol` AS `subtask_symbol`,`subtask`.`subtask_instruction` AS `subtask_instruction`,`subtask_category`.`subtask_category_name` AS `subtask_category_name`,`subtask_category`.`subtask_category_class` AS `subtask_category_class`,`subtask_category`.`subtask_category_description` AS `subtask_category_description` from (`lc60_subtasks` `subtask` left join `lc60_subtask_categories` `subtask_category` on((`subtask`.`subtask_category_id` = `subtask_category`.`id`)));
+CREATE ALGORITHM=UNDEFINED DEFINER=`tggtt`@`localhost` SQL SECURITY DEFINER VIEW `lc60_subtask_subtask_category` AS select `subtask`.`id` AS `subtask_id`,`subtask`.`task_id` AS `task_id`,`subtask`.`subtask_super_id` AS `subtask_super_id`,`subtask`.`subtask_name` AS `subtask_name`,`subtask`.`subtask_category_id` AS `subtask_category_id`,`subtask`.`subtask_base_value` AS `subtask_base_value`,`subtask`.`subtask_max_value` AS `subtask_max_value`,`subtask`.`subtask_starting_demand` AS `subtask_starting_demand`,`subtask`.`subtask_inflation_rate` AS `subtask_inflation_rate`,`subtask`.`subtask_demand_cutoff` AS `subtask_demand_cutoff`,`subtask`.`subtask_description` AS `subtask_description`,`subtask`.`subtask_url` AS `subtask_url`,`subtask`.`subtask_accumulative` AS `subtask_accumulative`,`subtask`.`subtask_task_period_demand` AS `subtask_task_period_demand`,`subtask`.`participant_id` AS `participant_id`,`subtask`.`subtask_dividend_rate` AS `subtask_dividend_rate`,`subtask`.`subtask_image` AS `subtask_image`,`subtask`.`subtask_symbol` AS `subtask_symbol`,`subtask`.`subtask_instruction` AS `subtask_instruction`,`subtask_category`.`subtask_category_name` AS `subtask_category_name`,`subtask_category`.`subtask_category_class` AS `subtask_category_class`,`subtask_category`.`subtask_category_description` AS `subtask_category_description` from (`lc60_subtasks` `subtask` left join `lc60_subtask_categories` `subtask_category` on((`subtask`.`subtask_category_id` = `subtask_category`.`id`)));
 
 -- --------------------------------------------------------
 

--
DROP TABLE IF EXISTS `lc60_successful_subtask_task`;

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `lc60_successful_subtask_task` AS select `successful_subtask`.`participant_id` AS `participant_id`,`successful_subtask`.`dream_id` AS `dream_id`,`successful_subtask`.`dream_type_id` AS `dream_type_id`,`successful_subtask`.`dream_timestamp` AS `dream_timestamp`,`successful_subtask`.`dream_url` AS `dream_url`,`task`.`id` AS `contemporary_task_id`,`task`.`task_start` AS `contemporary_task_start`,`task`.`task_expiration` AS `contemporary_task_expiration`,`successful_subtask`.`subtask_id` AS `subtask_id`,`successful_subtask`.`task_id` AS `subtask_task_id`,`successful_subtask`.`subtask_super_id` AS `subtask_super_id`,`successful_subtask`.`subtask_name` AS `subtask_name`,`successful_subtask`.`subtask_category_id` AS `subtask_category_id`,`successful_subtask`.`subtask_base_value` AS `subtask_base_value`,`successful_subtask`.`subtask_max_value` AS `subtask_max_value`,`successful_subtask`.`subtask_starting_demand` AS `subtask_starting_demand`,`successful_subtask`.`subtask_inflation_rate` AS `subtask_inflation_rate`,`successful_subtask`.`subtask_demand_cutoff` AS `subtask_demand_cutoff`,`successful_subtask`.`subtask_task_period_demand` AS `subtask_task_period_demand`,`successful_subtask`.`subtask_description` AS `subtask_description`,`successful_subtask`.`subtask_url` AS `subtask_url`,`successful_subtask`.`subtask_accumulative` AS `subtask_accumulative`,`successful_subtask`.`subtask_owner_participant_id` AS `subtask_owner_participant_id`,`successful_subtask`.`subtask_category_name` AS `subtask_category_name`,`successful_subtask`.`subtask_category_class` AS `subtask_category_class`,`successful_subtask`.`subtask_category_description` AS `subtask_category_description`,`successful_subtask`.`subtask_dividend_rate` AS `subtask_dividend_rate`,`successful_subtask`.`subtask_type_id` AS `subtask_type_id` from (`lc60_successful_subtask` `successful_subtask` join `lc60_tasks` `task` on(((`successful_subtask`.`dream_timestamp` > `task`.`task_start`) and (`successful_subtask`.`dream_timestamp` <= `task`.`task_expiration`))));

-- --------------------------------------------------------


--
DROP TABLE IF EXISTS `lc60_successful_subtask_task_with_calculated_total_participant`;

CREATE ALGORITHM=UNDEFINED DEFINER=`tggtt`@`localhost` SQL SECURITY DEFINER VIEW `lc60_successful_subtask_task_with_calculated_total_participant` AS select `participant`.`id` AS `participant_id`,`participant`.`participant_name` AS `participant`,`successful_subtask_task_with_calculated_total_complete`.`subtask_success_count_participant_total` AS `successes`,truncate(`successful_subtask_task_with_calculated_total_complete`.`final_value_total`,0) AS `score` from (`lc60_successful_subtask_task_with_calculated_total_complete` `successful_subtask_task_with_calculated_total_complete` join `lc60_participants` `participant` on((`successful_subtask_task_with_calculated_total_complete`.`participant_id` = `participant`.`id`)));

-- --------------------------------------------------------

