From 894534125008a6102ba21de05e7d7fb17694d37b Mon Sep 17 00:00:00 2001 From: Robin Olsen Date: Tue, 10 Mar 2026 13:30:53 +0100 Subject: [PATCH] change duration to ms instead of ns use better naming for last interface --- internal/app/statistics.go | 4 ++-- internal/models/statistics.go | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/internal/app/statistics.go b/internal/app/statistics.go index ae49fb8..cdf27e4 100644 --- a/internal/app/statistics.go +++ b/internal/app/statistics.go @@ -74,8 +74,8 @@ func (s *StatisticsService) RecordTaskRun(ctx context.Context, run models.TaskRu } stats.EndTime = now - stats.Duration = stats.EndTime.Sub(stats.StartTime) - stats.InterfaceType = run.InterfaceType + stats.DurationMs = stats.EndTime.Sub(stats.StartTime).Milliseconds() + stats.LastInterfaceType = run.InterfaceType stats.TaskRuns++ stats.LastTaskName = run.TaskName diff --git a/internal/models/statistics.go b/internal/models/statistics.go index e95d8f1..41041ac 100644 --- a/internal/models/statistics.go +++ b/internal/models/statistics.go @@ -7,15 +7,15 @@ import ( ) type Statistics struct { - ID primitive.ObjectID `bson:"_id" json:"id"` - StartTime time.Time `bson:"start_time" json:"start_time"` - EndTime time.Time `bson:"end_time" json:"end_time"` - Duration time.Duration `bson:"duration" json:"duration"` + ID primitive.ObjectID `bson:"_id" json:"id"` + StartTime time.Time `bson:"start_time" json:"start_time"` + EndTime time.Time `bson:"end_time" json:"end_time"` + DurationMs int64 `bson:"duration_ms" json:"duration_ms"` - InterfaceType InterfaceType `bson:"interface_type" json:"interface_type"` - TaskRuns int `bson:"task_runs" json:"task_runs"` - TasksCompleted int `bson:"tasks_completed" json:"tasks_completed"` - TasksFailed int `bson:"tasks_failed" json:"tasks_failed"` + LastInterfaceType InterfaceType `bson:"last_interface_type" json:"last_interface_type"` + TaskRuns int `bson:"task_runs" json:"task_runs"` + TasksCompleted int `bson:"tasks_completed" json:"tasks_completed"` + TasksFailed int `bson:"tasks_failed" json:"tasks_failed"` TotalDurationMs int64 `bson:"total_duration_ms" json:"total_duration_ms"` AverageDurationMs int64 `bson:"average_duration_ms" json:"average_duration_ms"`