ChemPal Documentation - v1.6.0
    Preparing search index...

    Function getSupplierStatsEntry

    • Reads the per-supplier stats recorded for one day.

      Parameters

      • dateKey: string

        The day to read, as YYYY-MM-DD.

      Returns Promise<undefined | Record<string, SupplierDayStats>>

      That day's stats keyed by supplier, or undefined when none exist.

      const day = await getSupplierStatsEntry("2026-07-18");
      day?.Loudwolf.queries; // => 3
      export async function getSupplierStatsEntry(
      dateKey: string,
      ): Promise<Record<string, SupplierDayStats> | undefined> {
      try {
      const db = await getDB();
      const record = await db.get(IDB_STORE.SUPPLIER_STATS, dateKey);
      return record?.suppliers;
      } catch (error) {
      logger.error('Failed to get supplier stats entry from IndexedDB', { error });
      return undefined;
      }
      }