FixUnrankedAgainIssues2 - Solve wrong position is shown when a result goes unranked again

This commit is contained in:
Joni
2024-08-19 20:54:13 +02:00
parent 748dc8fc61
commit 55fa7c0148
3 changed files with 68 additions and 4 deletions

View File

@@ -72,14 +72,13 @@ export const updateKeywordPosition = async (keywordRaw:Keyword, udpatedkeyword:
if (udpatedkeyword && keyword) {
const newPos = udpatedkeyword.position;
const newPosition = newPos !== 0 ? newPos : keyword.position;
const { history } = keyword;
const theDate = new Date();
const dateKey = `${theDate.getFullYear()}-${theDate.getMonth() + 1}-${theDate.getDate()}`;
history[dateKey] = newPosition;
history[dateKey] = newPos;
const updatedVal = {
position: newPosition,
position: newPos,
updating: false,
url: udpatedkeyword.url,
lastResult: udpatedkeyword.result,