mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-22 18:30:09 +00:00
Fix operator precedence for plannedAt calculation
This commit is contained in:
parent
d71bc0988f
commit
3fc4cfbcdd
4 changed files with 24 additions and 16 deletions
|
|
@ -85,32 +85,32 @@ export type IssueData =
|
|||
| RedmineIssue;
|
||||
|
||||
export type IssueDataReduced =
|
||||
| GithubIssueReduced
|
||||
| JiraIssueReduced
|
||||
| GitlabIssue
|
||||
| OpenProjectWorkPackageReduced
|
||||
| CaldavIssueReduced
|
||||
| ICalIssueReduced
|
||||
| GiteaIssue
|
||||
| RedmineIssue;
|
||||
| (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 });
|
||||
|
||||
export type IssueDataReducedMap = {
|
||||
[K in IssueProviderKey]: K extends 'JIRA'
|
||||
? JiraIssueReduced
|
||||
? JiraIssueReduced & { plannedAt?: string | null }
|
||||
: K extends 'GITHUB'
|
||||
? GithubIssueReduced
|
||||
? GithubIssueReduced & { plannedAt?: string | null }
|
||||
: K extends 'GITLAB'
|
||||
? GitlabIssue
|
||||
? GitlabIssue & { plannedAt?: string | null }
|
||||
: K extends 'CALDAV'
|
||||
? CaldavIssueReduced
|
||||
? CaldavIssueReduced & { plannedAt?: string | null }
|
||||
: K extends 'ICAL'
|
||||
? ICalIssueReduced
|
||||
? ICalIssueReduced & { plannedAt?: string | null }
|
||||
: K extends 'OPEN_PROJECT'
|
||||
? OpenProjectWorkPackageReduced
|
||||
? OpenProjectWorkPackageReduced & { plannedAt?: string | null }
|
||||
: K extends 'GITEA'
|
||||
? GiteaIssue
|
||||
? GiteaIssue & { plannedAt?: string | null }
|
||||
: K extends 'REDMINE'
|
||||
? RedmineIssue
|
||||
? RedmineIssue & { plannedAt?: string | null }
|
||||
: never;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -454,12 +454,18 @@ 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()),
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export const mapOpenProjectIssueReduced = (
|
|||
): OpenProjectWorkPackageReduced => {
|
||||
return {
|
||||
...issue,
|
||||
plannedAt: issue.startDate,
|
||||
url: `${cfg.host}/projects/${cfg.projectId}/work_packages/${issue.id}`,
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ export type OpenProjectWorkPackageReduced = OpenProjectOriginalWorkPackageReduce
|
|||
Readonly<{
|
||||
// added
|
||||
// transformed
|
||||
plannedAt: string | null;
|
||||
url: string;
|
||||
// removed
|
||||
}>;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue