diff --git a/app/utils/cloud/redisRestClient.ts b/app/utils/cloud/redisRestClient.ts index 267a76070..ed4addf7e 100644 --- a/app/utils/cloud/redisRestClient.ts +++ b/app/utils/cloud/redisRestClient.ts @@ -74,15 +74,11 @@ export const getAvailableDateKeys = async (): Promise => { export const getSignInCountForPeriod = async (dateKey: string): Promise => { try { - const counts = await redis.hgetall(`signin_count:${dateKey}`); + // Explicitly cast the result of redis.hgetall to an object with string values. + const counts = await redis.hgetall(`signin_count:${dateKey}`) as Record; return Object.values(counts).reduce((total, count) => { - // Ensure that 'count' is a string before parsing it to an integer. - if (typeof count === 'string') { - return total + parseInt(count, 10); - } else { - console.error(`Count value is not a string: ${count}`); - return total; - } + // Now TypeScript knows that 'count' is a string. + return total + parseInt(count, 10); }, 0); } catch (error) { console.error(`Failed to get sign-in count for period ${dateKey}`, error); @@ -91,6 +87,7 @@ export const getSignInCountForPeriod = async (dateKey: string): Promise }; + export const getDetailsByUser = async (dateKey: string): Promise> => { try { const rawCounts = await redis.hgetall(`signin_count:${dateKey}`);