summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-12-05 21:11:55 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-12-05 21:11:55 -0500
commit942dcd797e7c6693f6c1295da784c6163d8ffb3e (patch)
tree6e250838a240b6be817f04d51a07284c795cce9b
parent2c6d810411820fe5fc0826e37d2d663f7e579f30 (diff)
Improve random scripts
-rwxr-xr-xscripts/create-random-tasks.php16
-rwxr-xr-xscripts/create-sample-cfd.php48
2 files changed, 32 insertions, 32 deletions
diff --git a/scripts/create-random-tasks.php b/scripts/create-random-tasks.php
index 2b3d4eb6..98548445 100755
--- a/scripts/create-random-tasks.php
+++ b/scripts/create-random-tasks.php
@@ -9,7 +9,7 @@ use Model\Project;
use Model\ProjectPermission;
use Model\User;
-$task_per_column = 50;
+$task_per_column = 200;
$userModel = new User($container);
$projectModel = new Project($container);
@@ -17,15 +17,13 @@ $permissionModel = new ProjectPermission($container);
$taskModel = new TaskCreation($container);
$subtaskModel = new SubTask($container);
-for ($i = 0; $i <= 100; $i++) {
- $id = $projectModel->create(array(
- 'name' => 'Project #'.$i
- ));
+$project_id = $projectModel->create(array(
+ 'name' => 'Project #1'
+));
- $permissionModel->allowUser($id, 1);
-}
+$permissionModel->allowUser($project_id, 1);
-for ($i = 0; $i <= 500; $i++) {
+for ($i = 0; $i <= 5; $i++) {
$userModel->create(array(
'username' => 'user'.$i,
'password' => 'password'.$i,
@@ -40,7 +38,7 @@ foreach (array(1, 2, 3, 4) as $column_id) {
$task = array(
'title' => 'Task #'.$i.'-'.$column_id,
- 'project_id' => mt_rand(1, 100),
+ 'project_id' => 1,
'column_id' => $column_id,
'owner_id' => 1,
'color_id' => mt_rand(0, 1) === 0 ? 'green' : 'purple',
diff --git a/scripts/create-sample-cfd.php b/scripts/create-sample-cfd.php
index 5319a1ec..73135f7a 100755
--- a/scripts/create-sample-cfd.php
+++ b/scripts/create-sample-cfd.php
@@ -4,10 +4,12 @@
require __DIR__.'/../app/common.php';
use Model\ProjectDailySummary;
-use Model\Task;
+use Model\TaskCreation;
+use Model\TaskPosition;
$pds = new ProjectDailySummary($container);
-$taskModel = new Task($container);
+$taskCreation = new TaskCreation($container);
+$taskPosition = new TaskPosition($container);
for ($i = 1; $i <= 15; $i++) {
@@ -17,45 +19,45 @@ for ($i = 1; $i <= 15; $i++) {
'column_id' => 1,
);
- $taskModel->create($task);
+ $taskCreation->create($task);
}
$pds->updateTotals(1, date('Y-m-d', strtotime('-7 days')));
-$taskModel->movePosition(1, 1, 2, 1);
-$taskModel->movePosition(1, 2, 2, 1);
-$taskModel->movePosition(1, 3, 2, 1);
+$taskPosition->movePosition(1, 1, 2, 1);
+$taskPosition->movePosition(1, 2, 2, 1);
+$taskPosition->movePosition(1, 3, 2, 1);
$pds->updateTotals(1, date('Y-m-d', strtotime('-6 days')));
-$taskModel->movePosition(1, 3, 3, 1);
-$taskModel->movePosition(1, 4, 3, 1);
-$taskModel->movePosition(1, 5, 3, 1);
+$taskPosition->movePosition(1, 3, 3, 1);
+$taskPosition->movePosition(1, 4, 3, 1);
+$taskPosition->movePosition(1, 5, 3, 1);
$pds->updateTotals(1, date('Y-m-d', strtotime('-5 days')));
-$taskModel->movePosition(1, 5, 4, 1);
-$taskModel->movePosition(1, 6, 4, 1);
+$taskPosition->movePosition(1, 5, 4, 1);
+$taskPosition->movePosition(1, 6, 4, 1);
$pds->updateTotals(1, date('Y-m-d', strtotime('-4 days')));
-$taskModel->movePosition(1, 7, 4, 1);
-$taskModel->movePosition(1, 8, 4, 1);
+$taskPosition->movePosition(1, 7, 4, 1);
+$taskPosition->movePosition(1, 8, 4, 1);
$pds->updateTotals(1, date('Y-m-d', strtotime('-3 days')));
-$taskModel->movePosition(1, 9, 3, 1);
-$taskModel->movePosition(1, 10, 2, 1);
+$taskPosition->movePosition(1, 9, 3, 1);
+$taskPosition->movePosition(1, 10, 2, 1);
$pds->updateTotals(1, date('Y-m-d', strtotime('-2 days')));
-$taskModel->create(array('title' => 'Random task', 'project_id' => 1));
-$taskModel->movePosition(1, 11, 2, 1);
-$taskModel->movePosition(1, 12, 4, 1);
-$taskModel->movePosition(1, 13, 4, 1);
+$taskCreation->create(array('title' => 'Random task', 'project_id' => 1));
+$taskPosition->movePosition(1, 11, 2, 1);
+$taskPosition->movePosition(1, 12, 4, 1);
+$taskPosition->movePosition(1, 13, 4, 1);
$pds->updateTotals(1, date('Y-m-d', strtotime('-2 days')));
-$taskModel->movePosition(1, 14, 3, 1);
+$taskPosition->movePosition(1, 14, 3, 1);
$pds->updateTotals(1, date('Y-m-d', strtotime('-1 days')));
-$taskModel->movePosition(1, 15, 4, 1);
-$taskModel->movePosition(1, 16, 4, 1);
+$taskPosition->movePosition(1, 15, 4, 1);
+$taskPosition->movePosition(1, 16, 4, 1);
-$taskModel->create(array('title' => 'Random task', 'project_id' => 1));
+$taskCreation->create(array('title' => 'Random task', 'project_id' => 1));
$pds->updateTotals(1, date('Y-m-d')); \ No newline at end of file