From b35b26ce84a5b03471fcd668e4d79895c7cd7b11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dzieko=C5=84ski?= Date: Sun, 3 Jul 2022 22:00:54 +0200 Subject: [PATCH] GH-230 Move triggering referral task to an util --- modules/overview/_includes.php | 1 + .../triggerUserReferralTask.effect.php | 35 +++++++++++++++++++ overview.php | 22 ++---------- 3 files changed, 39 insertions(+), 19 deletions(-) create mode 100644 modules/overview/screens/FirstLogin/utils/effects/triggerUserReferralTask.effect.php diff --git a/modules/overview/_includes.php b/modules/overview/_includes.php index f29e7499..cc346c64 100644 --- a/modules/overview/_includes.php +++ b/modules/overview/_includes.php @@ -9,6 +9,7 @@ include($includePath . './screens/FirstLogin/FirstLogin.screen.php'); include($includePath . './screens/FirstLogin/utils/effects/handleProxyDetection.effect.php'); include($includePath . './screens/FirstLogin/utils/effects/handleReferralMultiAccountDetection.effect.php'); + include($includePath . './screens/FirstLogin/utils/effects/triggerUserReferralTask.effect.php'); include($includePath . './screens/FirstLogin/utils/helpers/getReferrerTasksData.helper.php'); }); diff --git a/modules/overview/screens/FirstLogin/utils/effects/triggerUserReferralTask.effect.php b/modules/overview/screens/FirstLogin/utils/effects/triggerUserReferralTask.effect.php new file mode 100644 index 00000000..c7a1032b --- /dev/null +++ b/modules/overview/screens/FirstLogin/utils/effects/triggerUserReferralTask.effect.php @@ -0,0 +1,35 @@ + function ($JobArray, $ThisCat, $TaskID, $JobID) use (&$referringUserWithTasksData) { + $taskStatusCheckResult = Tasks_TriggerTask_MainCheck_Progressive($JobArray, $ThisCat, $TaskID, $JobID, $referringUserWithTasksData, 1); + + $referringUserWithTasksData['TaskData'][] = [ + 'TaskID' => $TaskID, + 'TaskStatus' => $referringUserWithTasksData['tasks_done_parsed']['status'][$ThisCat][$TaskID][$JobID], + 'TaskLimit' => $JobArray[$JobArray['statusField']] + ]; + + return $taskStatusCheckResult; + } + ] + ); +} + +?> diff --git a/overview.php b/overview.php index 76cfd31c..4f20b585 100644 --- a/overview.php +++ b/overview.php @@ -66,25 +66,9 @@ 'referredById' => $_User['referred'], ]); - if(!empty($referringUserWithTasksData)) - { - Tasks_TriggerTask($referringUserWithTasksData, 'NEWUSER_REGISTER', array - ( - 'mainCheck' => function($JobArray, $ThisCat, $TaskID, $JobID) use (&$referringUserWithTasksData) - { - $Return = Tasks_TriggerTask_MainCheck_Progressive($JobArray, $ThisCat, $TaskID, $JobID, $referringUserWithTasksData, 1); - $referringUserWithTasksData['TaskData'][] = array - ( - 'TaskID' => $TaskID, - 'TaskStatus' => $referringUserWithTasksData['tasks_done_parsed']['status'][$ThisCat][$TaskID][$JobID], - 'TaskLimit' => $JobArray[$JobArray['statusField']] - ); - return $Return; - } - )); - } - - // Check IP Intersection + Overview\Screens\FirstLogin\Utils\Effects\triggerUserReferralTask([ + 'referringUserWithTasksData' => &$referringUserWithTasksData, + ]); Overview\Screens\FirstLogin\Utils\Effects\handleReferralMultiAccountDetection([ 'user' => &$_User, 'referredById' => $_User['referred'],