mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 15:23:38 +01:00
Updated merge logic.
This commit is contained in:
parent
9737127bb1
commit
db9b238585
@ -9,7 +9,7 @@ import PageviewsChart from '../metrics/PageviewsChart';
|
||||
import { getDateArray } from '../../lib/date';
|
||||
|
||||
function filterTime(data, time) {
|
||||
return data.filter(({ created_at }) => new Date(created_at).getTime() > time);
|
||||
return data.filter(({ created_at }) => new Date(created_at).getTime() >= time);
|
||||
}
|
||||
|
||||
function mapData(data) {
|
||||
@ -66,11 +66,11 @@ export default function RealtimeDashboard() {
|
||||
setData(init.data);
|
||||
} else if (updates) {
|
||||
const { pageviews, sessions, events } = updates;
|
||||
const time = subMinutes(startOfMinute(new Date()), 30).getTime();
|
||||
const minTime = subMinutes(startOfMinute(new Date()), 30).getTime();
|
||||
setData(state => ({
|
||||
pageviews: filterTime(state.pageviews, time).concat(pageviews),
|
||||
sessions: filterTime(state.sessions, time).concat(sessions),
|
||||
events: filterTime(state.events, time).concat(events),
|
||||
pageviews: filterTime(state.pageviews, minTime).concat(filterTime(pageviews, lastTime)),
|
||||
sessions: filterTime(state.sessions, minTime).concat(filterTime(sessions, lastTime)),
|
||||
events: filterTime(state.events, minTime).concat(filterTime(events, lastTime)),
|
||||
}));
|
||||
}
|
||||
setLastTime(Date.now());
|
||||
|
Loading…
Reference in New Issue
Block a user