 --
 DROP TABLE IF EXISTS `lc60_successful_subtask_task_with_calculated_total_participant`;
 
-CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`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`)));
+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`)));
 
 -- --------------------------------------------------------
 

--
DROP TABLE IF EXISTS `lc60_calculated_subtask_demand_inner`;

CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `lc60_calculated_subtask_demand_inner` AS select `calculated_subtask_demand_union`.`current_task_id` AS `current_task_id`,`calculated_subtask_demand_union`.`contemporary_task_id` AS `contemporary_task_id`,`calculated_subtask_demand_union`.`subtask_id` AS `subtask_id`,`calculated_subtask_demand_union`.`subtask_starting_demand` AS `subtask_starting_demand`,`calculated_subtask_demand_union`.`subtask_success_count` AS `subtask_success_count`,`calculated_subtask_demand_union`.`subtask_success_count_total` AS `subtask_success_count_total`,`calculated_subtask_demand_union`.`subtask_task_period_demand` AS `subtask_task_period_demand`,`calculated_subtask_demand_union`.`subtask_task_id` AS `subtask_task_id`,`calculated_subtask_demand_union`.`subtask_super_id` AS `subtask_super_id`,`calculated_subtask_demand_union`.`subtask_name` AS `subtask_name`,`calculated_subtask_demand_union`.`subtask_category_id` AS `subtask_category_id`,`calculated_subtask_demand_union`.`subtask_base_value` AS `subtask_base_value`,`calculated_subtask_demand_union`.`subtask_max_value` AS `subtask_max_value`,`calculated_subtask_demand_union`.`subtask_inflation_rate` AS `subtask_inflation_rate`,`calculated_subtask_demand_union`.`subtask_demand_cutoff` AS `subtask_demand_cutoff`,`calculated_subtask_demand_union`.`subtask_description` AS `subtask_description`,`calculated_subtask_demand_union`.`subtask_url` AS `subtask_url`,`calculated_subtask_demand_union`.`subtask_accumulative` AS `subtask_accumulative`,`calculated_subtask_demand_union`.`subtask_owner_participant_id` AS `subtask_owner_participant_id`,`calculated_subtask_demand_union`.`subtask_dividend_rate` AS `subtask_dividend_rate`,`calculated_subtask_demand_union`.`subtask_category_name` AS `subtask_category_name`,`calculated_subtask_demand_union`.`subtask_category_class` AS `subtask_category_class`,`calculated_subtask_demand_union`.`subtask_category_description` AS `subtask_category_description`,`calculated_subtask_demand_union`.`contemporary_demand` AS `contemporary_demand`,`calculated_subtask_demand_union`.`contemporary_demand_positive` AS `contemporary_demand_positive`,(case when (isnull(`calculated_subtask_demand_union`.`subtask_max_value`) or isnull(`calculated_subtask_demand_union`.`subtask_starting_demand`)) then 0 else (pow(`calculated_subtask_demand_union`.`contemporary_demand_positive`,(`calculated_subtask_demand_union`.`subtask_inflation_rate` / 100)) / `calculated_subtask_demand_union`.`subtask_demand_cutoff`) end) AS `inner_function` from `lc60_calculated_subtask_demand_union` `calculated_subtask_demand_union`;

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


--
DROP TABLE IF EXISTS `lc60_calculated_subtask_demand_union`;

CREATE ALGORITHM=UNDEFINED DEFINER=`tggtt`@`localhost` SQL SECURITY DEFINER VIEW `lc60_calculated_subtask_demand_union` AS select `demand_view_success_contemporary_demand_positive`.`current_task_id` AS `current_task_id`,`demand_view_success_contemporary_demand_positive`.`contemporary_task_id` AS `contemporary_task_id`,`demand_view_success_contemporary_demand_positive`.`subtask_id` AS `subtask_id`,`demand_view_success_contemporary_demand_positive`.`subtask_starting_demand` AS `subtask_starting_demand`,`demand_view_success_contemporary_demand_positive`.`subtask_success_count` AS `subtask_success_count`,`demand_view_success_contemporary_demand_positive`.`subtask_success_count_total` AS `subtask_success_count_total`,`demand_view_success_contemporary_demand_positive`.`subtask_task_period_demand` AS `subtask_task_period_demand`,`demand_view_success_contemporary_demand_positive`.`subtask_task_id` AS `subtask_task_id`,`demand_view_success_contemporary_demand_positive`.`subtask_super_id` AS `subtask_super_id`,`demand_view_success_contemporary_demand_positive`.`subtask_name` AS `subtask_name`,`demand_view_success_contemporary_demand_positive`.`subtask_category_id` AS `subtask_category_id`,`demand_view_success_contemporary_demand_positive`.`subtask_base_value` AS `subtask_base_value`,`demand_view_success_contemporary_demand_positive`.`subtask_max_value` AS `subtask_max_value`,`demand_view_success_contemporary_demand_positive`.`subtask_inflation_rate` AS `subtask_inflation_rate`,`demand_view_success_contemporary_demand_positive`.`subtask_demand_cutoff` AS `subtask_demand_cutoff`,`demand_view_success_contemporary_demand_positive`.`subtask_description` AS `subtask_description`,`demand_view_success_contemporary_demand_positive`.`subtask_url` AS `subtask_url`,`demand_view_success_contemporary_demand_positive`.`subtask_accumulative` AS `subtask_accumulative`,`demand_view_success_contemporary_demand_positive`.`subtask_owner_participant_id` AS `subtask_owner_participant_id`,`demand_view_success_contemporary_demand_positive`.`subtask_dividend_rate` AS `subtask_dividend_rate`,`demand_view_success_contemporary_demand_positive`.`subtask_category_name` AS `subtask_category_name`,`demand_view_success_contemporary_demand_positive`.`subtask_category_class` AS `subtask_category_class`,`demand_view_success_contemporary_demand_positive`.`subtask_category_description` AS `subtask_category_description`,`demand_view_success_contemporary_demand_positive`.`contemporary_demand` AS `contemporary_demand`,`demand_view_success_contemporary_demand_positive`.`contemporary_demand_positive` AS `contemporary_demand_positive` from `lc60_demand_view_success_contemporary_demand_positive` `demand_view_success_contemporary_demand_positive` union select `demand_view_uncomplete_contemporary_demand_positive`.`current_task_id` AS `current_task_id`,`demand_view_uncomplete_contemporary_demand_positive`.`contemporary_task_id` AS `contemporary_task_id`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_id` AS `subtask_id`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_starting_demand` AS `subtask_starting_demand`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_success_count` AS `subtask_success_count`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_success_count_total` AS `subtask_success_count_total`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_task_period_demand` AS `subtask_task_period_demand`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_task_id` AS `subtask_task_id`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_super_id` AS `subtask_super_id`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_name` AS `subtask_name`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_category_id` AS `subtask_category_id`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_base_value` AS `subtask_base_value`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_max_value` AS `subtask_max_value`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_inflation_rate` AS `subtask_inflation_rate`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_demand_cutoff` AS `subtask_demand_cutoff`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_description` AS `subtask_description`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_url` AS `subtask_url`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_accumulative` AS `subtask_accumulative`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_owner_participant_id` AS `subtask_owner_participant_id`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_dividend_rate` AS `subtask_dividend_rate`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_category_name` AS `subtask_category_name`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_category_class` AS `subtask_category_class`,`demand_view_uncomplete_contemporary_demand_positive`.`subtask_category_description` AS `subtask_category_description`,`demand_view_uncomplete_contemporary_demand_positive`.`contemporary_demand` AS `contemporary_demand`,`demand_view_uncomplete_contemporary_demand_positive`.`contemporary_demand_positive` AS `contemporary_demand_positive` from `lc60_demand_view_uncomplete_contemporary_demand_positive` `demand_view_uncomplete_contemporary_demand_positive`;

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

