fix some stats, increase store version
This commit is contained in:
parent
d12a82acdd
commit
857dd5f195
|
@ -15,7 +15,6 @@ import {
|
||||||
storeHourlyPixelsPlaced,
|
storeHourlyPixelsPlaced,
|
||||||
getHourlyPixelStats,
|
getHourlyPixelStats,
|
||||||
getDailyPixelStats,
|
getDailyPixelStats,
|
||||||
populateDailyTotal,
|
|
||||||
} from '../data/redis/ranks';
|
} from '../data/redis/ranks';
|
||||||
import socketEvents from '../socket/socketEvents';
|
import socketEvents from '../socket/socketEvents';
|
||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
|
@ -39,7 +38,7 @@ class Ranks {
|
||||||
// ranking of countries by day
|
// ranking of countries by day
|
||||||
cHistStats: [],
|
cHistStats: [],
|
||||||
// ranking of users by day
|
// ranking of users by day
|
||||||
histStats: [],
|
histStats: { users: [], stats: [] },
|
||||||
// pixels placed by hour
|
// pixels placed by hour
|
||||||
pHourlyStats: [],
|
pHourlyStats: [],
|
||||||
// pixels placed by day
|
// pixels placed by day
|
||||||
|
@ -57,7 +56,6 @@ class Ranks {
|
||||||
}
|
}
|
||||||
|
|
||||||
async initialize() {
|
async initialize() {
|
||||||
await populateDailyTotal();
|
|
||||||
try {
|
try {
|
||||||
let someRanks = await Ranks.dailyUpdateRanking();
|
let someRanks = await Ranks.dailyUpdateRanking();
|
||||||
this.ranks = {
|
this.ranks = {
|
||||||
|
|
|
@ -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
|
* get top 10 countries over the past days
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -15,7 +15,7 @@ import canvas from './reducers/canvas';
|
||||||
import chat from './reducers/chat';
|
import chat from './reducers/chat';
|
||||||
import fetching from './reducers/fetching';
|
import fetching from './reducers/fetching';
|
||||||
|
|
||||||
export const CURRENT_VERSION = 14;
|
export const CURRENT_VERSION = 15;
|
||||||
|
|
||||||
export const migrate = (state, version) => {
|
export const migrate = (state, version) => {
|
||||||
// eslint-disable-next-line no-underscore-dangle
|
// eslint-disable-next-line no-underscore-dangle
|
||||||
|
|
Loading…
Reference in New Issue
Block a user