Skip to content

Commit

Permalink
fix: refactor code in points-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
KseniaTry committed Oct 21, 2024
1 parent 765fc62 commit 0603127
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/utils/point-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ const getPointDuration = (pointDateFrom, pointDateTo) => {
return pointDuration.format('mm[M]');
};

function getWeightForPrice(a, b) {
if (a.basePrice < b.basePrice) {
function getWeightForPrice(pointA, pointB) {
if (pointA.basePrice < pointB.basePrice) {
return 1;
}

if (a.basePrice > b.basePrice) {
if (pointA.basePrice > pointB.basePrice) {
return -1;
}

if (a.basePrice === b.basePrice) {
if (pointA.basePrice === pointB.basePrice) {
return 0;
}
}
Expand All @@ -58,16 +58,16 @@ function getWeightForTime(pointA, pointB) {
}
}

function getWeigthForDay(a, b) {
if (a.dateFrom > b.dateFrom) {
function getWeigthForDay(pointA, pointB) {
if (pointA.dateFrom > pointB.dateFrom) {
return 1;
}

if (a.dateFrom < b.dateFrom) {
if (pointA.dateFrom < pointB.dateFrom) {
return -1;
}

if (a.dateFrom === b.dateFrom) {
if (pointA.dateFrom === pointB.dateFrom) {
return 0;
}
}
Expand Down

0 comments on commit 0603127

Please sign in to comment.