Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 4 additions & 3 deletions LoopFollow/Stats/SimpleStatsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,10 @@ class SimpleStatsViewModel: ObservableObject {

var currentTime = startTime
while currentTime < endTime {
let currentDate = Date(timeIntervalSince1970: currentTime)
let dayStart = calendar.startOfDay(for: currentDate).timeIntervalSince1970
let nextDayStart = dayStart + 24 * 60 * 60
let dayStartDate = calendar.startOfDay(for: Date(timeIntervalSince1970: currentTime))
guard let nextDayStartDate = calendar.date(byAdding: .day, value: 1, to: dayStartDate) else { break }
let dayStart = dayStartDate.timeIntervalSince1970
let nextDayStart = nextDayStartDate.timeIntervalSince1970

// Process each profile segment for this day
for i in 0 ..< sortedProfile.count {
Expand Down
7 changes: 4 additions & 3 deletions LoopFollow/Stats/StatsDataFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,10 @@ class StatsDataFetcher {

var currentTime = startTime
while currentTime < endTime {
let currentDate = Date(timeIntervalSince1970: currentTime)
let dayStart = calendar.startOfDay(for: currentDate).timeIntervalSince1970
let nextDayStart = dayStart + 24 * 60 * 60
let dayStartDate = calendar.startOfDay(for: Date(timeIntervalSince1970: currentTime))
guard let nextDayStartDate = calendar.date(byAdding: .day, value: 1, to: dayStartDate) else { break }
let dayStart = dayStartDate.timeIntervalSince1970
let nextDayStart = nextDayStartDate.timeIntervalSince1970

for i in 0 ..< sortedProfile.count {
let segmentRate = sortedProfile[i].value
Expand Down