|
|
@ -33,6 +33,17 @@ export function pushToClickLog(logElement) { |
|
|
|
setState({ sensorLog: sensorLog }); |
|
|
|
} |
|
|
|
|
|
|
|
const addLogElement = function (logElement) { |
|
|
|
const sensorLog = getState().sensorLog; |
|
|
|
const currentTime = new Date(); |
|
|
|
const visitLogElement = { |
|
|
|
visitLog: logElement, |
|
|
|
timestamp: currentTime, |
|
|
|
}; |
|
|
|
sensorLog.visitedSites.push(visitLogElement); |
|
|
|
setState({ sensorLog: sensorLog }); |
|
|
|
}; |
|
|
|
|
|
|
|
export function pushToVisitLog(logElement) { |
|
|
|
const sensorLog = getState().sensorLog; |
|
|
|
|
|
|
@ -46,14 +57,9 @@ export function pushToVisitLog(logElement) { |
|
|
|
) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const currentTime = new Date(); |
|
|
|
const visitLogElement = { |
|
|
|
visitLog: logElement, |
|
|
|
timestamp: currentTime, |
|
|
|
}; |
|
|
|
sensorLog.visitedSites.push(visitLogElement); |
|
|
|
setState({ sensorLog: sensorLog }); |
|
|
|
addLogElement(logElement); |
|
|
|
} else if (visitedSitesAmount === 0) { |
|
|
|
addLogElement(logElement); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|