summaryrefslogtreecommitdiff
path: root/scripts/create-random-tasks.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-11-15 21:49:06 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-11-15 21:49:06 -0500
commitaa6fffb05a7d84a36991341610675499b6ea8a79 (patch)
treee0eb08e76e61dfc5cc56ae0bfb7daf7dda49fc99 /scripts/create-random-tasks.php
parentaf93754ec99d8748677dc2cfd92137a8698a90fa (diff)
Add pagination and sorting to the dashboard
Diffstat (limited to 'scripts/create-random-tasks.php')
-rwxr-xr-xscripts/create-random-tasks.php49
1 files changed, 41 insertions, 8 deletions
diff --git a/scripts/create-random-tasks.php b/scripts/create-random-tasks.php
index 9391c68c..08aa01dd 100755
--- a/scripts/create-random-tasks.php
+++ b/scripts/create-random-tasks.php
@@ -4,9 +4,35 @@
require __DIR__.'/../app/common.php';
use Model\Task;
+use Model\SubTask;
+use Model\Project;
+use Model\ProjectPermission;
+use Model\User;
-$task_per_column = 250;
-$taskModel = new Task($registry);
+$task_per_column = 50;
+
+$userModel = new User($container);
+$projectModel = new Project($container);
+$permissionModel = new ProjectPermission($container);
+$taskModel = new Task($container);
+$subtaskModel = new SubTask($container);
+
+for ($i = 0; $i <= 100; $i++) {
+ $id = $projectModel->create(array(
+ 'name' => 'Project #'.$i
+ ));
+
+ $permissionModel->allowUser($id, 1);
+}
+
+for ($i = 0; $i <= 500; $i++) {
+ $userModel->create(array(
+ 'username' => 'user'.$i,
+ 'password' => 'password'.$i,
+ 'name' => 'User #'.$i,
+ 'email' => 'user'.$i.'@localhost',
+ ));
+}
foreach (array(1, 2, 3, 4) as $column_id) {
@@ -14,14 +40,21 @@ foreach (array(1, 2, 3, 4) as $column_id) {
$task = array(
'title' => 'Task #'.$i.'-'.$column_id,
- 'project_id' => 1,
+ 'project_id' => mt_rand(1, 100),
'column_id' => $column_id,
- 'owner_id' => rand(0, 1),
- 'color_id' => rand(0, 1) === 0 ? 'green' : 'purple',
- 'score' => rand(0, 21),
- 'is_active' => rand(0, 1),
+ 'owner_id' => 1,
+ 'color_id' => mt_rand(0, 1) === 0 ? 'green' : 'purple',
+ 'score' => mt_rand(0, 21),
+ 'is_active' => mt_rand(0, 1),
);
- $taskModel->create($task);
+ $id = $taskModel->create($task);
+
+ $subtaskModel->create(array(
+ 'title' => 'Subtask of task #'.$id,
+ 'user_id' => 1,
+ 'status' => mt_rand(0, 2),
+ 'task_id' => $id,
+ ));
}
}