| 784 | } |
| 785 | |
| 786 | func lastReportIntervalHasAtLeastSixDays(startTime, endTime time.Time) bool { |
| 787 | lastReportIntervalDays := endTime.Sub(startTime) % (7 * 24 * time.Hour) |
| 788 | if lastReportIntervalDays == 0 { |
| 789 | return true // this is a perfectly full week! |
| 790 | } |
| 791 | // Ensure that the last interval has at least 6 days, or check the special case, forward DST change, |
| 792 | // when the duration can be shorter than 6 days: 5 days 23 hours. |
| 793 | return lastReportIntervalDays >= 6*24*time.Hour || startTime.AddDate(0, 0, 6).Equal(endTime) |
| 794 | } |
| 795 | |
| 796 | func templateInsightsSectionAsStrings(sections ...codersdk.TemplateInsightsSection) []string { |
| 797 | t := make([]string, len(sections)) |