fix some stats, increase store version

This commit is contained in:
HF 2022-09-26 15:11:51 +02:00
parent d12a82acdd
commit 857dd5f195
3 changed files with 2 additions and 18 deletions

View File

@ -15,7 +15,6 @@ import {
storeHourlyPixelsPlaced,
getHourlyPixelStats,
getDailyPixelStats,
populateDailyTotal,
} from '../data/redis/ranks';
import socketEvents from '../socket/socketEvents';
import logger from './logger';
@ -39,7 +38,7 @@ class Ranks {
// ranking of countries by day
cHistStats: [],
// ranking of users by day
histStats: [],
histStats: { users: [], stats: [] },
// pixels placed by hour
pHourlyStats: [],
// pixels placed by day
@ -57,7 +56,6 @@ class Ranks {
}
async initialize() {
await populateDailyTotal();
try {
let someRanks = await Ranks.dailyUpdateRanking();
this.ranks = {

View File

@ -227,20 +227,6 @@ export async function getTopDailyHistory() {
};
}
/*
* for populating past daily totals
*/
export async function populateDailyTotal() {
await client.del(DAILY_PXL_CNTR_KEY);
for (let i = 14; i > 0; i -= 1) {
const ts = Date.now() - 1000 * 3600 * 24 * i;
const key = `${CDAY_STATS_RANKS_KEY}:${getDateKeyOfTs(ts)}`;
// eslint-disable-next-line no-await-in-loop
const sum = await sumZSet(key);
client.lPush(DAILY_PXL_CNTR_KEY, String(sum));
}
}
/*
* get top 10 countries over the past days
*/

View File

@ -15,7 +15,7 @@ import canvas from './reducers/canvas';
import chat from './reducers/chat';
import fetching from './reducers/fetching';
export const CURRENT_VERSION = 14;
export const CURRENT_VERSION = 15;
export const migrate = (state, version) => {
// eslint-disable-next-line no-underscore-dangle