Added filled gaps to time entry aggregation; Moved aggregation to service

This commit is contained in:
Constantin Graf
2024-05-21 17:31:45 +02:00
parent efd3fef0c5
commit 2a8ab12017
30 changed files with 1017 additions and 218 deletions

View File

@@ -36,6 +36,9 @@ class TogglDataImporter extends DefaultImporter
throw new ImportException('File "clients.json" can not be opened');
}
$clients = json_decode($clientsFileContent);
if ($clients === null) {
throw new ImportException('File "clients.json" is empty');
}
if (! file_exists($temporaryDirectory->path('projects.json'))) {
throw new ImportException('File "projects.json" missing in ZIP');
}
@@ -44,6 +47,9 @@ class TogglDataImporter extends DefaultImporter
throw new ImportException('File "projects.json" can not be opened');
}
$projects = json_decode($projectsFileContent);
if ($projects === null) {
throw new ImportException('File "projects.json" is empty');
}
if (! file_exists($temporaryDirectory->path('tags.json'))) {
throw new ImportException('File "tags.json" missing in ZIP');
}
@@ -52,6 +58,9 @@ class TogglDataImporter extends DefaultImporter
throw new ImportException('File "tags.json" can not be opened');
}
$tags = json_decode($tagsFileContent);
if ($tags === null) {
throw new ImportException('File "tags.json" is empty');
}
if (! file_exists($temporaryDirectory->path('workspace_users.json'))) {
throw new ImportException('File "workspace_users.json" missing in ZIP');
}
@@ -60,6 +69,9 @@ class TogglDataImporter extends DefaultImporter
throw new ImportException('File "workspace_users.json" can not be opened');
}
$workspaceUsers = json_decode($workspaceUsersFileContent);
if ($workspaceUsers === null) {
throw new ImportException('File "workspace_users.json" is empty');
}
foreach ($clients as $client) {
$this->clientImportHelper->getKey([
'name' => $client->name,
@@ -117,6 +129,9 @@ class TogglDataImporter extends DefaultImporter
throw new ImportException('File "projects_users/'.$project->id.'.json" can not be opened');
}
$projectMembers = json_decode($projectMembersFileContent);
if ($projectMembers === null) {
throw new ImportException('File "projects_users/'.$project->id.'.json" is empty');
}
foreach ($projectMembers as $projectMember) {
$userId = $this->userImportHelper->getKeyByExternalIdentifier((string) $projectMember->user_id);
$this->projectMemberImportHelper->getKey([
@@ -138,6 +153,9 @@ class TogglDataImporter extends DefaultImporter
throw new ImportException('File "tasks/'.$projectIdExternal.'.json" can not be opened');
}
$tasks = json_decode($tasksFileContent);
if ($tasks === null) {
throw new ImportException('File "tasks/'.$projectIdExternal.'.json" is empty');
}
foreach ($tasks as $task) {
$projectId = $this->projectImportHelper->getKeyByExternalIdentifier((string) $projectIdExternal);