Fix task id generation
This commit is contained in:
		| @@ -1,21 +0,0 @@ | ||||
| import { ActionController, registerAction } from './ActionController'; | ||||
| import { Args } from '../Command'; | ||||
| import { Task } from '../Queue/TaskQueue'; | ||||
| import { ActionError } from '../Errors'; | ||||
| import { getNumber } from '../utils'; | ||||
|  | ||||
| @registerAction | ||||
| export class GrabHeroAttributesAction extends ActionController { | ||||
|     async run(args: Args, task: Task): Promise<any> { | ||||
|         const healthElement = jQuery('#attributes .attribute.health .powervalue .value'); | ||||
|         if (healthElement.length !== 1) { | ||||
|             throw new ActionError(task.id, 'Health dom element not found'); | ||||
|         } | ||||
|  | ||||
|         const text = healthElement.text(); | ||||
|         let normalized = text.replace(/[^0-9]/g, ''); | ||||
|  | ||||
|         const value = getNumber(normalized); | ||||
|         // this.state.set('hero', { health: value }); | ||||
|     } | ||||
| } | ||||
| @@ -18,6 +18,7 @@ function uniqTaskId(): TaskId { | ||||
|     } else { | ||||
|         idSequence = 1; | ||||
|     } | ||||
|     lastTimestamp = ts; | ||||
|     return 'tid.' + ts + '.' + String(idSequence).padStart(4, '0') + '.' + uniqId(''); | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -2,7 +2,6 @@ import { Args, Command } from '../Command'; | ||||
| import { Task } from '../Queue/TaskQueue'; | ||||
| import { TaskController, registerTask } from './TaskController'; | ||||
| import { GoToPageAction } from '../Action/GoToPageAction'; | ||||
| import { GrabHeroAttributesAction } from '../Action/GrabHeroAttributesAction'; | ||||
| import { CompleteTaskAction } from '../Action/CompleteTaskAction'; | ||||
| import { SendOnAdventureAction } from '../Action/SendOnAdventureAction'; | ||||
| import { ClickButtonAction } from '../Action/ClickButtonAction'; | ||||
| @@ -17,7 +16,6 @@ export class SendOnAdventureTask extends TaskController { | ||||
|                 ...args, | ||||
|                 path: path('/hero.php'), | ||||
|             }), | ||||
|             new Command(GrabHeroAttributesAction.name, args), | ||||
|             new Command(GoToPageAction.name, { | ||||
|                 ...args, | ||||
|                 path: path('/hero.php', { t: 3 }), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user