mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-12 19:03:47 +00:00
refactor: restructure model to contain an object of rundowns
This commit is contained in:
@@ -4,7 +4,7 @@ import { MILLIS_PER_HOUR } from './conversionUtils';
|
||||
describe('checkIsNextDay', () => {
|
||||
it('returns false if there is no previous event', () => {
|
||||
const current = { timeStart: 0, dayOffset: 0 };
|
||||
const previous = undefined;
|
||||
const previous = null;
|
||||
expect(checkIsNextDay(current, previous)).toBeFalsy();
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { dayInMs } from './conversionUtils.js';
|
||||
*/
|
||||
export function checkIsNextDay(
|
||||
current: Pick<OntimeEvent, 'timeStart' | 'dayOffset'>,
|
||||
previous?: Pick<OntimeEvent, 'timeStart' | 'duration' | 'dayOffset'>,
|
||||
previous: Pick<OntimeEvent, 'timeStart' | 'duration' | 'dayOffset'> | null,
|
||||
): boolean {
|
||||
if (!previous) {
|
||||
return false;
|
||||
|
||||
@@ -7,7 +7,7 @@ import { dayInMs } from './conversionUtils.js';
|
||||
*/
|
||||
export function getTimeFromPrevious(
|
||||
current: Pick<OntimeEvent, 'timeStart' | 'dayOffset'>,
|
||||
previous?: Pick<OntimeEvent, 'timeStart' | 'duration' | 'dayOffset'>,
|
||||
previous: Pick<OntimeEvent, 'timeStart' | 'duration' | 'dayOffset'> | null,
|
||||
): number {
|
||||
// there is no previous event
|
||||
if (!previous) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import { isNewLatest } from './isNewLatest';
|
||||
describe('isNewLatest', () => {
|
||||
it('should be true if there is no previous', () => {
|
||||
const current = { timeStart: 0, duration: MILLIS_PER_HOUR, dayOffset: 0 };
|
||||
const previous = undefined;
|
||||
const previous = null;
|
||||
expect(isNewLatest(current, previous)).toBe(true);
|
||||
});
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import { dayInMs } from './conversionUtils.js';
|
||||
*/
|
||||
export function isNewLatest(
|
||||
currentEvent: Pick<OntimeEvent, 'timeStart' | 'duration' | 'dayOffset'>,
|
||||
previousEvent?: Pick<OntimeEvent, 'timeStart' | 'duration' | 'dayOffset'>,
|
||||
previousEvent: Pick<OntimeEvent, 'timeStart' | 'duration' | 'dayOffset'> | null,
|
||||
) {
|
||||
// true if there is no previous
|
||||
if (!previousEvent) {
|
||||
|
||||
Reference in New Issue
Block a user