mirror of
https://github.com/towfiqi/serpbear
synced 2025-06-26 18:15:54 +00:00
fixes: Wrong position change indicator when >100
This commit is contained in:
parent
be5ec96699
commit
74c9603293
@ -56,6 +56,9 @@ const Keyword = (props: KeywordProps) => {
|
||||
const historySorted = historyArray.sort((a, b) => a.date - b.date);
|
||||
const previousPos = historySorted[historySorted.length - 2].position;
|
||||
status = previousPos === 0 ? position : previousPos - position;
|
||||
if (position === 0 && previousPos > 0) {
|
||||
status = previousPos - 100;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
}, [history, position]);
|
||||
|
@ -60,7 +60,10 @@ const getPositionChange = (history:KeywordHistory, position:number) : number =>
|
||||
}));
|
||||
const historySorted = historyArray.sort((a, b) => a.date - b.date);
|
||||
const previousPos = historySorted[historySorted.length - 2].position;
|
||||
status = previousPos - position;
|
||||
status = previousPos === 0 ? position : previousPos - position;
|
||||
if (position === 0 && previousPos > 0) {
|
||||
status = previousPos - 100;
|
||||
}
|
||||
}
|
||||
return status;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user