diff --git a/ai.go b/ai.go index 74a8fb58..29e7da81 100644 --- a/ai.go +++ b/ai.go @@ -7196,7 +7196,7 @@ func sendAITokenLimitAlert(ctx context.Context, execution WorkflowExecution, ful appRunsLimit := int64(0) orgStats, statsErr := GetOrgStatistics(ctx, billingOrgId) if statsErr == nil && orgStats != nil { - stats := handleGetCorrectedStats(orgStats) + stats := GetCorrectedStats(orgStats) totalAppExecutions = stats.MonthlyAppExecutions + stats.MonthlyChildAppExecutions } if fullOrg != nil { diff --git a/db-connector.go b/db-connector.go index e98b9276..3699377d 100755 --- a/db-connector.go +++ b/db-connector.go @@ -127,7 +127,7 @@ func SetOrgStatistics(ctx context.Context, stats ExecutionInfo, id string) error } stat.Date = stat.Date.UTC() - statdate := stat.Date.Format("2006-12-30") + statdate := stat.Date.Format("2006-01-02") if !ArrayContains(allDates, statdate) { newDaily = append(newDaily, stat) allDates = append(allDates, statdate) diff --git a/stats.go b/stats.go index 7a84a62c..e8d6876a 100755 --- a/stats.go +++ b/stats.go @@ -850,7 +850,7 @@ func HandleGetStatistics(resp http.ResponseWriter, request *http.Request) { } } - stats := handleGetCorrectedStats(info) + stats := GetCorrectedStats(info) newjson, err := json.Marshal(stats) if err != nil { @@ -865,7 +865,7 @@ func HandleGetStatistics(resp http.ResponseWriter, request *http.Request) { } // Make sure that we are not calling SetOrgStatistics function after calling this function. This will increase the app runs count in db on every call to this function. -func handleGetCorrectedStats(info *ExecutionInfo) *ExecutionInfo { +func GetCorrectedStats(info *ExecutionInfo) *ExecutionInfo { // 1 Million Input Tokens = 250 app runs // 1 Million Output Tokens = 1500 app runs