From 5c6b32d5bbd7d8f5e5130db20dfc655a45d5ed4c Mon Sep 17 00:00:00 2001 From: Constantin Graf Date: Mon, 16 Sep 2024 21:23:00 +0200 Subject: [PATCH] Deactivate auditing for time entries in importer --- app/Service/Import/Importers/ClockifyTimeEntriesImporter.php | 1 + app/Service/Import/Importers/SolidtimeImporter.php | 1 + app/Service/Import/Importers/TogglTimeEntriesImporter.php | 1 + .../Service/Import/Importers/TogglTimeEntriesImporterTest.php | 4 ++-- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Service/Import/Importers/ClockifyTimeEntriesImporter.php b/app/Service/Import/Importers/ClockifyTimeEntriesImporter.php index 10136bd3..a35bb7a3 100644 --- a/app/Service/Import/Importers/ClockifyTimeEntriesImporter.php +++ b/app/Service/Import/Importers/ClockifyTimeEntriesImporter.php @@ -99,6 +99,7 @@ public function importData(string $data, string $timezone): void ]); } $timeEntry = new TimeEntry; + $timeEntry->disableAuditing(); $timeEntry->user_id = $userId; $timeEntry->member_id = $memberId; $timeEntry->task_id = $taskId; diff --git a/app/Service/Import/Importers/SolidtimeImporter.php b/app/Service/Import/Importers/SolidtimeImporter.php index 724d43ca..f5b76190 100644 --- a/app/Service/Import/Importers/SolidtimeImporter.php +++ b/app/Service/Import/Importers/SolidtimeImporter.php @@ -221,6 +221,7 @@ public function importData(string $data, string $timezone): void $taskId = $this->taskImportHelper->getKeyByExternalIdentifier($timeEntryRow['task_id']); } $timeEntry = new TimeEntry; + $timeEntry->disableAuditing(); $timeEntry->user_id = $userId; $timeEntry->member_id = $memberId; $timeEntry->task_id = $taskId; diff --git a/app/Service/Import/Importers/TogglTimeEntriesImporter.php b/app/Service/Import/Importers/TogglTimeEntriesImporter.php index cb24b415..a6efa6e4 100644 --- a/app/Service/Import/Importers/TogglTimeEntriesImporter.php +++ b/app/Service/Import/Importers/TogglTimeEntriesImporter.php @@ -99,6 +99,7 @@ public function importData(string $data, string $timezone): void ]); } $timeEntry = new TimeEntry; + $timeEntry->disableAuditing(); $timeEntry->user_id = $userId; $timeEntry->member_id = $memberId; $timeEntry->task_id = $taskId; diff --git a/tests/Unit/Service/Import/Importers/TogglTimeEntriesImporterTest.php b/tests/Unit/Service/Import/Importers/TogglTimeEntriesImporterTest.php index fb482a59..65880133 100644 --- a/tests/Unit/Service/Import/Importers/TogglTimeEntriesImporterTest.php +++ b/tests/Unit/Service/Import/Importers/TogglTimeEntriesImporterTest.php @@ -36,7 +36,7 @@ public function test_import_of_test_file_succeeds(): void $queryLog = DB::getQueryLog(); // Assert - $this->assertCount(23, $queryLog); + $this->assertCount(21, $queryLog); $testScenario = $this->checkTestScenarioAfterImportExcludingTimeEntries(); $this->checkTimeEntries($testScenario); $this->assertSame(2, $report->timeEntriesCreated); @@ -67,7 +67,7 @@ public function test_import_of_test_file_twice_succeeds(): void $queryLog = DB::getQueryLog(); // Assert - $this->assertCount(15, $queryLog); + $this->assertCount(13, $queryLog); $testScenario = $this->checkTestScenarioAfterImportExcludingTimeEntries(); $this->checkTimeEntries($testScenario, true); $this->assertSame(2, $report->timeEntriesCreated);