Skip to content

Function: resolveTimeEntryOverlaps()

function resolveTimeEntryOverlaps(existingTimeEntries, newTimeEntry): {
adjustedTimeEntries: | {
active_seconds: number;
created_at: string;
currency: | "USD"
| "EUR"
| "GBP"
| "CAD"
| "AUD"
| "JPY"
| "CHF"
| "CNY"
| "INR"
| "BRL"
| "VEF";
end_time: string;
hourly_payment: boolean;
id: string;
memo: string | null;
paid: boolean;
payout_id: string | null;
salary: number;
start_time: string;
time_fragments_interval: number | null;
user_id: string;
work_project_id: string;
}[]
| null;
overlappingTimeEntries: {
active_seconds: number;
created_at: string;
currency: | "USD"
| "EUR"
| "GBP"
| "CAD"
| "AUD"
| "JPY"
| "CHF"
| "CNY"
| "INR"
| "BRL"
| "VEF";
end_time: string;
hourly_payment: boolean;
id: string;
memo: string | null;
paid: boolean;
payout_id: string | null;
salary: number;
start_time: string;
time_fragments_interval: number | null;
user_id: string;
work_project_id: string;
}[];
};

Defined in: shared/src/helper/workHelper/resolveTimeEntryOverlaps.ts:11

Filters out existing time entries that overlap with the new time entry. If there are no collisions, returns the new session as is. If there are collisions, adjusts the session to fit the collisions.

ParameterTypeDescription
existingTimeEntries{ active_seconds: number; created_at: string; currency: | "USD" | "EUR" | "GBP" | "CAD" | "AUD" | "JPY" | "CHF" | "CNY" | "INR" | "BRL" | "VEF"; end_time: string; hourly_payment: boolean; id: string; memo: string | null; paid: boolean; payout_id: string | null; salary: number; start_time: string; time_fragments_interval: number | null; user_id: string; work_project_id: string; }[]Existing time entries
newTimeEntry{ active_seconds: number; created_at: string; currency: | "USD" | "EUR" | "GBP" | "CAD" | "AUD" | "JPY" | "CHF" | "CNY" | "INR" | "BRL" | "VEF"; end_time: string; hourly_payment: boolean; id: string; memo: string | null; paid: boolean; payout_id: string | null; salary: number; start_time: string; time_fragments_interval: number | null; user_id: string; work_project_id: string; }New time entry
newTimeEntry.active_secondsnumber-
newTimeEntry.created_atstring-
newTimeEntry.currency| "USD" | "EUR" | "GBP" | "CAD" | "AUD" | "JPY" | "CHF" | "CNY" | "INR" | "BRL" | "VEF"-
newTimeEntry.end_timestring-
newTimeEntry.hourly_paymentboolean-
newTimeEntry.idstring-
newTimeEntry.memostring | null-
newTimeEntry.paidboolean-
newTimeEntry.payout_idstring | null-
newTimeEntry.salarynumber-
newTimeEntry.start_timestring-
newTimeEntry.time_fragments_intervalnumber | null-
newTimeEntry.user_idstring-
newTimeEntry.work_project_idstring-
{
adjustedTimeEntries: | {
active_seconds: number;
created_at: string;
currency: | "USD"
| "EUR"
| "GBP"
| "CAD"
| "AUD"
| "JPY"
| "CHF"
| "CNY"
| "INR"
| "BRL"
| "VEF";
end_time: string;
hourly_payment: boolean;
id: string;
memo: string | null;
paid: boolean;
payout_id: string | null;
salary: number;
start_time: string;
time_fragments_interval: number | null;
user_id: string;
work_project_id: string;
}[]
| null;
overlappingTimeEntries: {
active_seconds: number;
created_at: string;
currency: | "USD"
| "EUR"
| "GBP"
| "CAD"
| "AUD"
| "JPY"
| "CHF"
| "CNY"
| "INR"
| "BRL"
| "VEF";
end_time: string;
hourly_payment: boolean;
id: string;
memo: string | null;
paid: boolean;
payout_id: string | null;
salary: number;
start_time: string;
time_fragments_interval: number | null;
user_id: string;
work_project_id: string;
}[];
}

Adjusted session Array and overlapping sessions

NameTypeDefined in
adjustedTimeEntries| { active_seconds: number; created_at: string; currency: | "USD" | "EUR" | "GBP" | "CAD" | "AUD" | "JPY" | "CHF" | "CNY" | "INR" | "BRL" | "VEF"; end_time: string; hourly_payment: boolean; id: string; memo: string | null; paid: boolean; payout_id: string | null; salary: number; start_time: string; time_fragments_interval: number | null; user_id: string; work_project_id: string; }[] | nullshared/src/helper/workHelper/resolveTimeEntryOverlaps.ts:15
overlappingTimeEntries{ active_seconds: number; created_at: string; currency: | "USD" | "EUR" | "GBP" | "CAD" | "AUD" | "JPY" | "CHF" | "CNY" | "INR" | "BRL" | "VEF"; end_time: string; hourly_payment: boolean; id: string; memo: string | null; paid: boolean; payout_id: string | null; salary: number; start_time: string; time_fragments_interval: number | null; user_id: string; work_project_id: string; }[]shared/src/helper/workHelper/resolveTimeEntryOverlaps.ts:16