1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 09:02:28 +01:00

Feature/task order (#3807)

This commit is contained in:
Jim C K Flaten 2022-03-28 21:31:35 +02:00 committed by GitHub
parent 82818414a3
commit 2680fe4c8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -104,7 +104,8 @@ class RunTaskJob extends Job implements ShouldQueue
{ {
/** @var \Pterodactyl\Models\Task|null $nextTask */ /** @var \Pterodactyl\Models\Task|null $nextTask */
$nextTask = Task::query()->where('schedule_id', $this->task->schedule_id) $nextTask = Task::query()->where('schedule_id', $this->task->schedule_id)
->where('sequence_id', $this->task->sequence_id + 1) ->orderBy('sequence_id', 'asc')
->where('sequence_id', '>', $this->task->sequence_id)
->first(); ->first();
if (is_null($nextTask)) { if (is_null($nextTask)) {

View File

@ -41,7 +41,8 @@ class TaskRepository extends EloquentRepository implements TaskRepositoryInterfa
public function getNextTask(int $schedule, int $index) public function getNextTask(int $schedule, int $index)
{ {
return $this->getBuilder()->where('schedule_id', '=', $schedule) return $this->getBuilder()->where('schedule_id', '=', $schedule)
->where('sequence_id', '=', $index + 1) ->orderBy('sequence_id', 'asc')
->where('sequence_id', '>', $index)
->first($this->getColumns()); ->first($this->getColumns());
} }
} }

View File

@ -139,7 +139,7 @@ export default () => {
</div> </div>
<div css={tw`bg-neutral-700 rounded-b`}> <div css={tw`bg-neutral-700 rounded-b`}>
{schedule.tasks.length > 0 ? {schedule.tasks.length > 0 ?
schedule.tasks.map(task => ( schedule.tasks.sort((a, b) => a.sequenceId === b.sequenceId ? 0 : (a.sequenceId > b.sequenceId ? 1 : -1)).map(task => (
<ScheduleTaskRow key={`${schedule.id}_${task.id}`} task={task} schedule={schedule}/> <ScheduleTaskRow key={`${schedule.id}_${task.id}`} task={task} schedule={schedule}/>
)) ))
: :