refactor: optimize repoGetTodayStudyStats with SQL aggregation and use shared constants

- Replace JS counting with Prisma groupBy for better performance
- Add DEFAULT_NEW_PER_DAY and DEFAULT_REV_PER_DAY constants
- Use constants in InDeck.tsx
This commit is contained in:
2026-03-16 09:31:21 +08:00
parent ada2f249ee
commit 1d5732abc8
3 changed files with 36 additions and 21 deletions

View File

@@ -19,4 +19,18 @@ export const LENGTH_MIN_TRANSLATOR_TEXT = 1;
export const LENGTH_MAX_USERNAME = 30;
export const LENGTH_MIN_USERNAME = 3;
export const LENGTH_MAX_PASSWORD = 100;
export const LENGTH_MIN_PASSWORD = 8;
export const LENGTH_MIN_PASSWORD = 8;
export const FIELD_SEPARATOR = "\x1f";
export const DEFAULT_NEW_PER_DAY = 20;
export const DEFAULT_REV_PER_DAY = 200;
export const SECONDS_PER_MINUTE = 60;
export const SECONDS_PER_HOUR = 3600;
export const SECONDS_PER_DAY = 86400;
export const MS_PER_SECOND = 1000;
export const MS_PER_MINUTE = 60000;
export const MS_PER_HOUR = 3600000;
export const MS_PER_DAY = 86400000;