Added estimated time to clockify project import

This commit is contained in:
Constantin Graf
2025-02-04 13:45:10 -05:00
committed by Constantin Graf
parent 18162b0ff5
commit 0252d984cb
3 changed files with 4 additions and 1 deletions

View File

@@ -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,
]);
}

View File

@@ -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","",""
1 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
2 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
3 Project without Client Active Public Yes 0.00 0.00 0.00 0.00 Constantin Graf

View File

@@ -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');