Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert to int64
  • Loading branch information
mtojek committed Sep 15, 2023
commit e957d16f22b2516fd256a4a8f8d28267a87257e7
4 changes: 2 additions & 2 deletions coderd/database/dbfake/dbfake.go
Original file line number Diff line number Diff line change
Expand Up @@ -2424,9 +2424,9 @@ func (q *FakeQuerier) GetTemplateInsightsByInterval(ctx context.Context, arg dat
templateIDSet map[uuid.UUID]struct{}
}

statsByInterval := []statByInterval{{arg.StartTime, arg.StartTime.Add(arg.Interval), make(map[uuid.UUID]struct{}), make(map[uuid.UUID]struct{})}}
statsByInterval := []statByInterval{{arg.StartTime, arg.StartTime.Add(time.Duration(arg.Interval)), make(map[uuid.UUID]struct{}), make(map[uuid.UUID]struct{})}}
for statsByInterval[len(statsByInterval)-1].endTime.Before(arg.EndTime) {
statsByInterval = append(statsByInterval, statByInterval{statsByInterval[len(statsByInterval)-1].endTime, statsByInterval[len(statsByInterval)-1].endTime.Add(arg.Interval), make(map[uuid.UUID]struct{}), make(map[uuid.UUID]struct{})})
statsByInterval = append(statsByInterval, statByInterval{statsByInterval[len(statsByInterval)-1].endTime, statsByInterval[len(statsByInterval)-1].endTime.Add(time.Duration(arg.Interval)), make(map[uuid.UUID]struct{}), make(map[uuid.UUID]struct{})})
}
if statsByInterval[len(statsByInterval)-1].endTime.After(arg.EndTime) {
statsByInterval[len(statsByInterval)-1].endTime = arg.EndTime
Expand Down
8 changes: 4 additions & 4 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions coderd/database/sqlc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ overrides:
- column: "template_with_users.group_acl"
go_type:
type: "TemplateACL"
- db_type: "pg_catalog.interval"
engine: "postgresql"
go_type:
import: "time"
type: "Duration"
rename:
template: TemplateTable
template_with_user: Template
Expand Down
2 changes: 1 addition & 1 deletion coderd/insights.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ func (api *API) insightsTemplates(rw http.ResponseWriter, r *http.Request) {
StartTime: startTime,
EndTime: endTime,
TemplateIDs: templateIDs,
Interval: 24 * time.Hour,
Interval: int64(24 * time.Hour),
})
if err != nil {
return xerrors.Errorf("get template daily insights: %w", err)
Expand Down