fix: wrong month stats and db cache undefined handling
This commit is contained in:
parent
ee5d986972
commit
ec1ea5cfe8
4 changed files with 54 additions and 67 deletions
|
@ -142,7 +142,9 @@ export const cached = <T extends unknown[], R, TT>(fn: (...args: T) => R, self?:
|
|||
isPromise = promisified == newValue;
|
||||
|
||||
void promisified.then((result) => {
|
||||
cache.set(cacheName, cacheKey, result);
|
||||
if (result !== undefined) {
|
||||
cache.set(cacheName, cacheKey, result);
|
||||
}
|
||||
});
|
||||
|
||||
return newValue;
|
||||
|
|
|
@ -57,8 +57,7 @@ export const createMessageStatsSources = (
|
|||
person[message.fromRecipientId] += 1;
|
||||
|
||||
// increment the message count of the message's month for this recipient
|
||||
// months are an array from 0 - 11
|
||||
month[messageDate.getMonth() - 1][message.fromRecipientId] += 1;
|
||||
month[messageDate.getMonth()][message.fromRecipientId] += 1;
|
||||
|
||||
// biome-ignore lint/style/noNonNullAssertion: <explanation>
|
||||
const dateStatsEntry = date.find(({ date }) => isSameDay(date, messageDate))!;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue