diff --git a/app/Service/Import/Importers/ClockifyProjectsImporter.php b/app/Service/Import/Importers/ClockifyProjectsImporter.php index 63938d5e..0353d7e2 100644 --- a/app/Service/Import/Importers/ClockifyProjectsImporter.php +++ b/app/Service/Import/Importers/ClockifyProjectsImporter.php @@ -43,6 +43,7 @@ class ClockifyProjectsImporter extends DefaultImporter 'color' => $this->colorService->getRandomColor(), 'is_billable' => $record['Billability'] === 'Yes', 'billable_rate' => $billableRateKey !== null && $record[$billableRateKey] !== '' ? (int) (((float) $record[$billableRateKey]) * 100) : null, + 'estimated_time' => $record['Estimated (h)'] !== '' && is_numeric($record['Estimated (h)']) ? (int) ($record['Estimated (h)'] * 3600) : null, ]); } diff --git a/resources/testfiles/clockify_projects_import_test_1.csv b/resources/testfiles/clockify_projects_import_test_1.csv index cb979bab..7ecb020d 100644 --- a/resources/testfiles/clockify_projects_import_test_1.csv +++ b/resources/testfiles/clockify_projects_import_test_1.csv @@ -1,3 +1,3 @@ "Project","Client","Status","Visibility","Billability","Task","Tracked (h)","Estimated (h)","Remaining (h)","Overage (h)","Progress(%)","Billable (h)","Non-billable (h)","Billable Rate (USD)","Amount (USD)","Project members","Project manager","Note" -"Project for Big Company","Big Company","Active","Public","Yes","Task 1, Task 2, Task 3","0.00","","","","","0.00","0.00","100.01","0.00","Constantin Graf","","" +"Project for Big Company","Big Company","Active","Public","Yes","Task 1, Task 2, Task 3","0.00","1001.11","","","","0.00","0.00","100.01","0.00","Constantin Graf","","" "Project without Client","","Active","Public","Yes","","0.00","","","","","0.00","0.00","","0.00","Constantin Graf","","" diff --git a/tests/Unit/Service/Import/Importers/ImporterTestAbstract.php b/tests/Unit/Service/Import/Importers/ImporterTestAbstract.php index 3a85f9ca..294254b9 100644 --- a/tests/Unit/Service/Import/Importers/ImporterTestAbstract.php +++ b/tests/Unit/Service/Import/Importers/ImporterTestAbstract.php @@ -147,10 +147,12 @@ class ImporterTestAbstract extends TestCase $project1 = $projects->firstWhere('name', 'Project without Client'); $this->assertNotNull($project1); $this->assertNull($project1->client_id); + $this->assertSame(null, $project1->estimated_time); $project2 = $projects->firstWhere('name', 'Project for Big Company'); $this->assertNotNull($project2); $this->assertSame(10001, $project2->billable_rate); $this->assertSame($client1->getKey(), $project2->client_id); + $this->assertSame(3603996, $project2->estimated_time); $tasks = Task::all(); $this->assertCount(3, $tasks); $task1 = $tasks->firstWhere('name', 'Task 1');