summaryrefslogtreecommitdiff
path: root/scripts
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
parentaf93754ec99d8748677dc2cfd92137a8698a90fa (diff)
Add pagination and sorting to the dashboard
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/create-random-projects.php18
-rwxr-xr-xscripts/create-random-tasks.php49
-rwxr-xr-xscripts/create-random-users.php2
3 files changed, 60 insertions, 9 deletions
diff --git a/scripts/create-random-projects.php b/scripts/create-random-projects.php
new file mode 100755
index 00000000..5cab1a25
--- /dev/null
+++ b/scripts/create-random-projects.php
@@ -0,0 +1,18 @@
+#!/usr/bin/env php
+<?php
+
+require __DIR__.'/../app/common.php';
+
+use Model\Project;
+use Model\ProjectPermission;
+
+$projectModel = new Project($container);
+$permissionModel = new ProjectPermission($container);
+
+for ($i = 0; $i < 100; $i++) {
+ $id = $projectModel->create(array(
+ 'name' => 'Project #'.$i
+ ));
+
+ $permissionModel->allowUser($id, 1);
+}
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,
+ ));
}
}
diff --git a/scripts/create-random-users.php b/scripts/create-random-users.php
index 47336c64..a8b7e4d3 100755
--- a/scripts/create-random-users.php
+++ b/scripts/create-random-users.php
@@ -5,7 +5,7 @@ require __DIR__.'/../app/common.php';
use Model\User;
-$userModel = new User($registry);
+$userModel = new User($container);
for ($i = 0; $i < 500; $i++) {
$userModel->create(array(