diff --git a/.swp b/.swp new file mode 100644 index 000000000..570a327ae Binary files /dev/null and b/.swp differ diff --git a/src/app/features/issue/issue.model.ts b/src/app/features/issue/issue.model.ts index dfb36ec8c..266909727 100644 --- a/src/app/features/issue/issue.model.ts +++ b/src/app/features/issue/issue.model.ts @@ -85,32 +85,32 @@ export type IssueData = | RedmineIssue; export type IssueDataReduced = - | (GithubIssueReduced & { plannedAt?: string | null }) - | (JiraIssueReduced & { plannedAt?: string | null }) - | (GitlabIssue & { plannedAt?: string | null }) - | (OpenProjectWorkPackageReduced & { plannedAt?: string | null }) - | (CaldavIssueReduced & { plannedAt?: string | null }) - | (ICalIssueReduced & { plannedAt?: string | null }) - | (GiteaIssue & { plannedAt?: string | null }) - | (RedmineIssue & { plannedAt?: string | null }); + | GithubIssueReduced + | JiraIssueReduced + | GitlabIssue + | OpenProjectWorkPackageReduced + | CaldavIssueReduced + | ICalIssueReduced + | GiteaIssue + | RedmineIssue; export type IssueDataReducedMap = { [K in IssueProviderKey]: K extends 'JIRA' - ? JiraIssueReduced & { plannedAt?: string | null } + ? JiraIssueReduced : K extends 'GITHUB' - ? GithubIssueReduced & { plannedAt?: string | null } + ? GithubIssueReduced : K extends 'GITLAB' - ? GitlabIssue & { plannedAt?: string | null } + ? GitlabIssue : K extends 'CALDAV' - ? CaldavIssueReduced & { plannedAt?: string | null } + ? CaldavIssueReduced : K extends 'ICAL' - ? ICalIssueReduced & { plannedAt?: string | null } + ? ICalIssueReduced : K extends 'OPEN_PROJECT' - ? OpenProjectWorkPackageReduced & { plannedAt?: string | null } + ? OpenProjectWorkPackageReduced : K extends 'GITEA' - ? GiteaIssue & { plannedAt?: string | null } + ? GiteaIssue : K extends 'REDMINE' - ? RedmineIssue & { plannedAt?: string | null } + ? RedmineIssue : never; }; diff --git a/src/app/features/issue/issue.service.ts b/src/app/features/issue/issue.service.ts index 0f5692af2..fc3c75ad0 100644 --- a/src/app/features/issue/issue.service.ts +++ b/src/app/features/issue/issue.service.ts @@ -454,18 +454,12 @@ export class IssueService { } }; - const oneDayInMilliseconds = 24 * 60 * 60 * 1000; - const taskData = { issueType: issueProviderKey, issueProviderId: issueProviderId, issueId: issueDataReduced.id.toString(), issueWasUpdated: false, issueLastUpdated: Date.now(), - plannedAt: issueDataReduced.plannedAt - ? new Date(new Date(issueDataReduced.plannedAt).setHours(6, 0, 0, 0)).getTime() + - oneDayInMilliseconds - : null, // Adjust plannedAt to 6 AM or set it to null if not present ...additionalFromProviderIssueService, // NOTE: if we were to add tags, this could be overwritten here ...(await getProjectOrTagId()), diff --git a/src/app/features/issue/providers/open-project/open-project-common-interfaces.service.ts b/src/app/features/issue/providers/open-project/open-project-common-interfaces.service.ts index e14d8c575..3341029e4 100644 --- a/src/app/features/issue/providers/open-project/open-project-common-interfaces.service.ts +++ b/src/app/features/issue/providers/open-project/open-project-common-interfaces.service.ts @@ -132,6 +132,8 @@ export class OpenProjectCommonInterfacesService implements IssueServiceInterface }); } + readonly oneDayInMilliseconds = 24 * 60 * 60 * 1000; + getAddTaskData( issue: OpenProjectWorkPackageReduced, ): Partial & { title: string } { @@ -144,6 +146,10 @@ export class OpenProjectCommonInterfacesService implements IssueServiceInterface issuePoints: issue.storyPoints, issueWasUpdated: false, // NOTE: we use Date.now() instead to because updated does not account for comments + plannedAt: issue.plannedAt + ? new Date(new Date(issue.plannedAt).setHours(7, 30, 0, 0)).getTime() + + this.oneDayInMilliseconds + : null, // Adjust plannedAt to 7 AM or set it to null if not present issueLastUpdated: new Date(issue.updatedAt).getTime(), ...(parsedEstimate > 0 ? { timeEstimate: parsedEstimate } : {}), };