qa.py (2839B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\packages\dailygoals\client\qa.py 2 from carbonui.control.contextMenu.menuEntryData import MenuEntryDataSlider, MenuEntryDataCheckbox 3 from clientsettings.setting import UserSettingNumeric 4 from dailygoals.client.goalsController import DailyGoalsController 5 from dailygoals.client.qa_settings import daily_goals_get_goals_force_errors, daily_goals_get_goals_force_delay, daily_goals_get_goals_randomize_errors, daily_goals_use_mock 6 import blue 7 8 def get_insider_qa_menu(): 9 menu = ('Daily Goals', (('Flush cache', _flush), ('Regenerate', _regenerate), ('Loading & Failure', (('Reset All', _reset_all_settings), ('Get Goals', (MenuEntryDataCheckbox('Use Mock Data', setting=daily_goals_use_mock, hint='When on we mock out data we are unable to fetch'), 10 MenuEntryDataCheckbox('Force Errors', setting=daily_goals_get_goals_force_errors, hint='Errors when fetching daily goals of today. If this is used once AO has been opened the cache must be flushed for this to have a noticable effect'), 11 MenuEntryDataCheckbox('Randomize Errors', setting=daily_goals_get_goals_randomize_errors, hint='If raising errors this will raise them 50% of the time instead of always'), 12 MenuEntryDataSlider('Force Delays', setting=daily_goals_get_goals_force_delay, min_label='0', max_label='5'))))))) 13 return menu 14 15 16 def get_job_qa_menu_entries(goal_id, current_progress, max_progress): 17 setting = UserSettingNumeric('qa_set_daily_goal_progress_setting', default_value=current_progress, min_value=current_progress, max_value=max_progress) 18 setting.set(current_progress) 19 menu_entries = (('QA - Copy Goal ID {goal_id}'.format(goal_id=goal_id), lambda : blue.pyos.SetClipboardData(str(goal_id))), ('QA - Complete Goal', lambda : _request_set_progress(goal_id, max_progress)), MenuEntryDataSlider('QA - Progress Goal', setting, min_label=str(setting.min_value), max_label=str(setting.max_value))) 20 return (menu_entries, setting) 21 22 23 def get_reward_qa_menu_entries(goal_id): 24 menu_entries = (('QA - Expire Entitlement', lambda : _expire_goal(goal_id)), ('QA - Copy Goal ID {goal_id}'.format(goal_id=goal_id), lambda : blue.pyos.SetClipboardData(str(goal_id)))) 25 return menu_entries 26 27 28 def _expire_goal(goal_id): 29 command = '/dailygoals expire {goal_id}'.format(goal_id=goal_id) 30 sm.RemoteSvc('slash').SlashCmd(command) 31 32 33 def _request_set_progress(goal_id, progress_to_set): 34 DailyGoalsController.get_instance().admin_set_progress(goal_id, progress_to_set) 35 36 37 def _flush(): 38 DailyGoalsController.get_instance().flush_cache() 39 40 41 def _regenerate(): 42 sm.GetService('slash').SlashCmd('/dailygoals regen') 43 _flush() 44 45 46 def _reset_all_settings(): 47 daily_goals_get_goals_force_errors.set(False) 48 daily_goals_get_goals_force_delay.set(0)