trunc seconds when fitting tourney bars into lanes

pull/9871/head
nickolay 2021-09-23 21:40:49 +03:00
parent 92027fce43
commit d2114d7a6d
1 changed files with 5 additions and 2 deletions

View File

@ -71,12 +71,15 @@ function group(arr: Tournament[], grouper: (t: Tournament) => number): Lane[] {
}
function truncSeconds(epoch: number): number {
return epoch - (epoch % (60*1000));
return epoch - (epoch % (60 * 1000));
}
function fitLane(lane: Lane, tour2: Tournament) {
return !lane.some(function (tour1: Tournament) {
return !(truncSeconds(tour1.finishesAt) <= truncSeconds(tour2.startsAt) || truncSeconds(tour2.finishesAt) <= truncSeconds(tour1.startsAt));
return !(
truncSeconds(tour1.finishesAt) <= truncSeconds(tour2.startsAt) ||
truncSeconds(tour2.finishesAt) <= truncSeconds(tour1.startsAt)
);
});
}