Skip to content

Commit a9094a4

Browse files
committed
Use configuration time range in StoreInfoProvider.swift
1 parent 224eea6 commit a9094a4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

WooCommerce/StoreWidgets/StoreInfoDataService.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ final class StoreInfoDataService {
1717
///
1818
private var orderStatsRemoteV4: OrderStatsRemoteV4
1919

20-
/// Visitors remoute source
20+
/// Visitors remote source
2121
///
2222
private var siteVisitStatsRemote: SiteVisitStatsRemote
2323

@@ -31,9 +31,9 @@ final class StoreInfoDataService {
3131
siteVisitStatsRemote = SiteVisitStatsRemote(network: network)
3232
}
3333

34-
/// Async function that fetches todays stats data.
34+
/// Async function that fetches stats data for given time range.
3535
///
36-
func fetchTodayStats(for storeID: Int64) async throws -> Stats {
36+
func fetchStats(for storeID: Int64, timeRange: StatsTimeRange) async throws -> Stats {
3737
// Prepare them to run in parallel
3838
async let revenueAndOrdersRequest = fetchTodaysRevenueAndOrders(for: storeID)
3939
async let visitorsRequest = fetchTodaysVisitors(for: storeID)

WooCommerce/StoreWidgets/StoreInfoProvider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ final class StoreInfoProvider: IntentTimelineProvider {
9090
networkService = strongService
9191
Task {
9292
do {
93-
let todayStats = try await strongService.fetchTodayStats(for: dependencies.storeID)
93+
let todayStats = try await strongService.fetchStats(for: dependencies.storeID, timeRange: StatsTimeRange(configuration.timeRange))
9494
let entry = Self.dataEntry(for: todayStats, with: dependencies)
9595
let reloadDate = Date(timeIntervalSinceNow: reloadInterval)
9696
let timeline = Timeline<StoreInfoEntry>(entries: [entry], policy: .after(reloadDate))

0 commit comments

Comments
 (0)